Matlab Commands
Matlab Commands
ezcontour(f,[-3,3],49)
--------------------------------------- grid of 49 by 49
x = -3:3;
y = [-1 -1 -1 0 1 1 1];
t = -3:.01:3;
p = pchip(x,y,t);
s = spline(x,y,t);
plot(x,y,'o',t,p,'-',t,s,'-.')
legend('data','pchip','spline',4)
x = a:b;
y = cos(x);
pp = spline(x,y);
int2 = integral(@(x)ppval(pp,x),a,b)
syms x
y = solve(x^2 - 2,x)
y =
2^(1/2)
-2^(1/2)
Approximate the solutions with floating-point numbers:
vpa(y(1))
vpa(y(2))
ans =
1.4142135623730950488016887242097
ans =
-1.4142135623730950488016887242097
syms x y z
jacobian([x*y*z, y^2, x + z], [x, y, z])
ans =
[ y*z, x*z, x*y]
[
0, 2*y,
0]
1,
1]
0,
syms x y z
jacobian(2*x + 3*y + 4*z, [x, y, z])
ans =
[ 2, 3, 4]
Now, compute the gradient of the same expression.
gradient(2*x + 3*y + 4*z, [x, y, z])
ans =
2
3
4
syms x y
jacobian([x^2*y, x*sin(y)], x)
ans =
2*x*y
sin(y)
Now, compute the derivatives.
diff([x^2*y, x*sin(y)], x)
ans =
[ 2*x*y, sin(y)]
[V,D]=eig(K,M)
TT=@(x) 73.4523*exp(0.1*x)-53.4523*exp(-0.1*x)+20;