Skip to content
Snippets Groups Projects
Commit 3b4d80f2 authored by JB's avatar JB
Browse files

added some things for sec 1

parent 3670c270
No related branches found
No related tags found
No related merge requests found
......@@ -8,3 +8,29 @@ w = x + y;
z = w * y;
z = 4 * z; % z = 4 * (x + y) * y
J = jacobian(z,y); % node in graph
%% Function
f = Function('f' , {x, y}, {z});
r = f(1, 2) % evaluates the function
class(r) % returns the type, casadi.DM
r2 = full(r) % converts from DM to double
class(r2) % returns the type, double
function [z] = f1(x,y)
w = x + y;
z = w * y;
z = 4 * z;
end
r = f1(x, y) % different than Function
class(r) % casadi.MX
%%
x = MX.sym('x');
y = MX.sym('y');
w = x + y;
z = w * y;
z = 4 * z; % z = 4 * (x + y) * y
f2 = Function('f' , {x, y}, {z});
f3 = Function('f' , {x, y}, {4 * (x + y) * y});
\ No newline at end of file
......@@ -32,4 +32,3 @@ disp(fMX, true);
disp('Function fSX: ');
disp(fSX, true);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment