Bài tập Matlab Toán ứng dụng

13 12 0
Bài tập Matlab Toán ứng dụng

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Toán ứng dụng là ngành học ứng dụng các phương pháp, mô hình toán học vào giải quyết các vấn đề trong khoa học, kỹ thuật, kinh tế, tài chính, bảo hiểm, khoa học máy tính và công . Chuỗi bài tập Matlab đưa ra một số giải pháp giải cho môn học Toán ứng dụng.

Course: Computer application in vehicle simulation 01 %Sovle 1st equation %f(x)=(a+b)*x*2+(d-E)*x+d^2 %Argue follow times a, b, d, E %solution a=input ('input a') b=input ('input b') d=input ('input d') E=input ('input E') x=1 y = (a+b)*x^2+(d-E)*x+d^2 y=0 if (a+b)==0 disp ('Equation has only a roof') x = -(d-E)/(d^2) else delta = ((d-E)*(d-E))-4*(a+b)*d^2 if (delta==0) disp ('Equation has dual roofs') x=-(d-E)/(2*(a+b)) else if (delta>0) disp ('Equation has dictince roofs') x1 = -((d-E)+sqrt(delta))/2*(a+b) x2 = -((d-E)-sqrt(delta))/2*(a+b) else disp('Eqution has no roof') end end end %Sovle 2nd question %f(x1)= 5*x1^3-6*x1^2+3*sqrt(x1)-7 %f(x2)=7*x2^4-3*x2^3-2*sqrt(exp^(x2)) %x1 from (1to100), x2 from 20 to 80 %S=(f(x1)+f(x2))-f(x2)^2+sqrt(f(x1)) %solution x1=1:1:100 x2=20:1:100 y1=5*x1.^3-6*x1.^2+3*sqrt(x1)-7 y2=7*x2.^4-3*x2.^3-2*sqrt(exp(x2)) subplot(2,1,1) plot(x1,y1,'r') %x = linspace(0,3); title('Figure 1') xlabel('Horizontal axis') ylabel('Vertical axis ') grid on subplot(2,1,2) plot(x2,y2) title('Figure 2') xlabel('Horizontal axis') ylabel('Vertical axis') grid on % Caculate S=(f(x1)+f(x2))-f(x2)^2+sqrt(f(x1)), x=5 a1=5 a2=5 y(a1)=5*a1.^3-6*a1.^2+3*sqrt(a1)-7 y(a2)=7*a2.^4-3*a2.^3-2*sqrt(exp(a2)) disp('Sum of the equation') s=y(a1)+y(a2)-y(a2).^2+sqrt(y(a1)) %Sovle 3rd question %y1=x.^4+x.^3-8*x.^2+3*sin(x)*cos(x)*exp((cos(x)-(sin(x))) %y2=tan g(x).^4+exp((tan(g(x))-cos(x)))-abs(g(x.^3))-(exp(cotan(x.^2)))+ (sin(x).^4)+(cos(x).^3) %x from to 100 %Use plot, subplot to draw charts x=1:1:100 %x = linspace(1); y1=(x.^4)+(x.^3)-8*(x.^2)+3*sin(x).*cos(x).*exp(cos(x)-sin(x)) y2=tan(x).^4+exp(tan(x)-cos(x))-abs(tan(x).^3exp(cot(x).^2)+sin(x).^4+cos(x).^3); subplot(2,1,2) plot(x,y1) title('Figure 2') xlabel('Horizontal axis') ylabel('Vertical axis') grid on subplot(2,1,1) plot(x,y2) title('Figure 1') xlabel('Horizontal axis') ylabel('Vertical axis') grid on %Sovle 4th question %Equation y = a*x*2+b*x-c % S= e^x-(x+1)/2+(x+2)/3+(x+3)/4+(x+n)/(n+1) a=input ('Input a') b=input ('Input b') c=input ('Input c') n=input ('Input n') x=10 y = a*x*2+b*x-c y=0 if a==0 disp ('Equation has only a root') x0 = c/b disp ('Sum of the equation') S0= exp(x0)-(x0+1)/2+(x0+2)/3+(x0+3)/4+(x0+n)/(n+1) else delta = b.^2-4*a*c if (delta==0) disp ('Equation has dual roots') x1=-b/(2*a) disp ('Sum of the equation') S1= exp(x1)-(x1+1)/2+(x1+2)/3+(x1+3)/4+(x1+n)/(n+1) else disp ('Equation has dictince roofs') x2 = -b-sqrt(delta)/(2*a) disp ('Sum of the equation') S2= exp(x2)-(x2+1)/2+(x2+2)/3+(x2+3)/4+(x2+n)/(n+1) disp ('Sum of the equation') x3 = -b+sqrt(delta)/(2*a) S3= exp(x3)-(x3+1)/2+(x3+2)/3+(x3+3)/4+(x3+n)/(n+1) end end %Sovle 4th question %Equation y = a*x*2+b*x-c % S= e^x-(x+1)/2+(x+2)/3+(x+3)/4+(x+n)/(n+1) a=input ('Input a') b=input ('Input b') c=input ('Input c') n=input ('Input n') x=10 y = a*x*2+b*x-c y=0 if a==0 disp ('Equation has only a root') x0 = c/b disp ('Sum of the equation') S0= exp(x0)-(x0+1)/2+(x0+2)/3+(x0+3)/4+(x0+n)/(n+1) else delta = b.^2-4*a*c if (delta==0) disp ('Equation has dual roots') x1=-b/(2*a) disp ('Sum of the equation') S1= exp(x1)-(x1+1)/2+(x1+2)/3+(x1+3)/4+(x1+n)/(n+1) else disp ('Equation has dictince roofs') x2 = -b-sqrt(delta)/(2*a) disp ('Sum of the equation') S2= exp(x2)-(x2+1)/2+(x2+2)/3+(x2+3)/4+(x2+n)/(n+1) disp ('Sum of the equation') x3 = -b+sqrt(delta)/(2*a) S3= exp(x3)-(x3+1)/2+(x3+2)/3+(x3+3)/4+(x3+n)/(n+1) end end %sovle 5th question %Equation a*exp(2*x)+b*exp(x)+c %S= e^x+pi-(x+1)/2+(x+2)/3+(x+3)/4+(x+n)/(n+1) a=input ('input a') b=input ('input b') c=input ('input c') N=input('input n'); y = a*x*2+b*x-c S= exp(x)-(x+1)/2+(x+2)/3+(x+3)/4+(x+n)/(n+1) delta=0; A0=0; if(a)==0 disp('The eqaution has only root') x0=(c)/b for n=1:N A0=A0+((x0+n)/(n+1)); disp('Sum of the equation') S=exp(x0)+ pi - A0 end else delta= (b).^-4*a*c if delta0 syms x eqn= exp(x)==u ; x = solve(eqn,x) %int (nguyen)=int(x) %disp('Sum of the equation') S = sqrt(x^3-sin(x))+tan(x).^3-3*cos(x)+2-cot(x); else disp(' u not true with conditon(u>0)') end else delta= b.^2-4*a*c if delta0 syms x eqn= exp(x)==u ; x = solve(eqn,x) %int (nguyen)= int(x) %disp('Sum of the equation') S = sqrt(x^3-sin(x))+tan(x).^3-3*cos(x)+2-cot(x); else end end end %Sovle 8th question %Equation f(x1)=5*x1.^3-6*x1.^2+3*(sqrt(x1))-7; %Equation f(x2)=7*x2.^4-3*(x2).^3-2*(sqrt(exp(x2)-sqrt(x2)))+x2 %at x=5 , S=((f(x1)+f(x2))-(f(x2)).^2+sqrt(f(x1)) x1=1:1:100 ; x2=20:1:80; y1=5*x1.^3-6*x1.^2+3*(sqrt(x1))-7; subplot(2,1,1) plot(x1,y1,'m') title('Figure 1') xlabel('Horizontal axis') ylabel('Vertical axis') grid on y2=7*x2.^4-3*(x2).^3-2*(sqrt(exp(x2)-sqrt(x2)))+x2; subplot(2,1,2) plot(x2,y2,'k') title('Figure 2') xlabel('Horizontal axis') ylabel('Vertical axis ') grid on S =0; a= 5;% a=x=5 b= 5;% b=x=5 f(a)=5*a.^3-6*a.^2+3*(sqrt(a))-7; f(b)=7*b.^4-3*(b).^3-2*(sqrt(exp(b)-sqrt(b)))+b; S =(f(a)+f(b))-(f(b).^2)+sqrt(f(a))

Ngày đăng: 02/12/2021, 23:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan