MATLAB Plotting of curves and surfaces Week: 2 METHOD 1 x=linspace(0,1,101) plot(x,x.^3, 'r+' ,x,sin(x), 'b-' ,x,exp(x), 'g.' ) METHOD 2 using Hold on clear all x=linspace(0,1,101) plot(x,x^3, 'r*' ) hold on plot(x,sin(x), 'g.' ) hold on plot (x,exp(x), 'b+' ) If we remove hold on, only last graph will be displayed. METHOD 3 using subplot x=0:.1:2*pi; subplot(2,2,1); plot (x,sin(x)); subplot(2,2,2); plot(x,cos(x)); subplot(2,2,3); plot(x,exp(-x)); subplot(2,2,4); plot(x,sin(3*x)); Diffrentiation syms x y f=x^2+2*x*y+y*sin(x) diff(f,x) diff(f,y) f =2*x*y + y*sin(x) + x^2 ans = 2*x + 2*y + y*cos(x) ans = 2*x + sin(x) Integration syms x f=x^3 + 3*x^2 + 5*x + 12 int(f,x,0,2) f = x^3 + 3*x^2 + 5*x + 12 ans = 46 Plotting graph syms x f=sin(2*x)+ cos(3*x) ezplot(f) ...
Comments
Post a Comment