1. Trang chủ
  2. » Khoa Học Tự Nhiên

mô phỏng vật lý cho đại học

2 206 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 30,5 KB

Nội dung

close all;clear all; clc hptvp=D2y=2y+4x2exp(x2); ytt=dsolve(hptvp,x) dkb=y(0)=3,y(2)=5; y= dsolve(hptvp,dkb, x); y=simple(y) ezplot(y,0 2);grid on; hold on; %c) f=inline( char(y),x); title(Xac dinh khong diem); x0,y0=ginput; for k=1:length(x0); xn(k),fn(k)=fsolve(f,x0(k)); end; plot(xn,fn,ro); title(Xac dinh cuc tieu); xc,yc=ginput; for k=1:length(xc); xm(k),fm(k)=fminsearch(f,xc(k)); end; plot(xm,fm,b); clear all; close all; clc; sol=dsolve(Dy=(2x32x22y)(x2x2),x) y=dsolve(Dy=(2x32x22y)(x2x2),y(1)=2, x) ezplot(y,1 5); hold on; grid on; %c) f=inline( char(y),x); title(Xac dinh khong diem); x0,y0=ginput; for k=1:length(x0); xn(k),fn(k)=fsolve(f,x0(k)); end; plot(xn,fn,ro); title(Xac dinh cuc dai); xc,yc=ginput; for k=1:length(x0); xm(k),fm(k)=fminsearch(f,xc(k)); end; ym=subs(y,xm); plot(xm,ym,b);clear all;clc; xi=0:10; xc=sqrt(xi); % doi bien yi=0.4 8.9 12.23 15.33 18.3 20.28 22.9 24.9 26.63 28.62 30.3; %a) a=polyfit(xc,yi,2); a0=a(2), a1=a(1), a2=a(3) syms x y=a0sqrt(x)+a1x+a2; ezplot(y,0 10); hold on; plot(xi,yi,r); grid on; legend(duong cong xap xi,cac diem thuc no); %b) y2=x(32)+5; h=ezplot(y2,0 10); set(h,Color,g); title(chon cac diem giao nhau cua 2 duong); f=inline( char(yy2),x ); x0,y0=ginput; for k=1:length(x0); xn(k),fn(k)=fsolve(f,x0(k)); end; yn=subs(y,xn); plot(xn,yn,ro); f2=inline( a(1)sqrt(x)+a(2)x+a(3),a,x); an, dn=lsqcurvefit(f2,a0 a1 a2,xi,yi); an, eee=ana0 a1 a2

close all;clear all; clc hptvp='D2y=2*y+4*x^2*exp(x^2)'; ytt=dsolve(hptvp,'x') dkb='y(0)=3,y(2)=5'; y= dsolve(hptvp,dkb, 'x'); y=simple(y) ezplot(y,[0 2]);grid on; hold on; % c) f=inline( char(y),'x'); title('Xac dinh khong diem'); [x0,y0]=ginput; for k=1:length(x0); [xn(k),fn(k)]=fsolve(f,x0(k)); end; plot(xn,fn,'ro'); title('Xac dinh cuc tieu'); [xc,yc]=ginput; for k=1:length(xc); [xm(k),fm(k)]=fminsearch(f,xc(k)); end; plot(xm,fm,'b*'); clear all; close all; clc; sol=dsolve('Dy=(2*x^3-2*x^2-2-y)/(x-2*x^2)','x') y=dsolve('Dy=(2*x^3-2*x^2-2-y)/(x-2*x^2)','y(1)=2', 'x') ezplot(y,[1 5]); hold on; grid on; % -c) f=inline( char(-y),'x'); title('Xac dinh khong diem'); [x0,y0]=ginput; for k=1:length(x0); [xn(k),fn(k)]=fsolve(f,x0(k)); end; plot(xn,fn,'ro'); title('Xac dinh cuc dai'); [xc,yc]=ginput; for k=1:length(x0); [xm(k),fm(k)]=fminsearch(f,xc(k)); end; ym=subs(y,xm); plot(xm,ym,'b*');clear all;clc; xi=0:10; xc=sqrt(xi); % doi bien yi=[0.4 8.9 12.23 15.33 18.3 20.28 22.9 24.9 26.63 28.62 30.3]; % a) a=polyfit(xc,yi,2); a0=a(2), a1=a(1), a2=a(3) syms x y=a0*sqrt(x)+a1*x+a2; ezplot(y,[0 10]); hold on; plot(xi,yi,'r*'); grid on; legend('duong cong xap xi','cac diem thuc no'); % b) y2=x^(3/2)+5; h=ezplot(y2,[0 10]); set(h,'Color','g'); title('chon cac diem giao cua duong'); f=inline( char(y-y2),'x' ); [x0,y0]=ginput; for k=1:length(x0); [xn(k),fn(k)]=fsolve(f,x0(k)); end; yn=subs(y,xn); plot(xn,yn,'ro'); f2=inline( 'a(1)*sqrt(x)+a(2)*x+a(3)','a','x'); [an, dn]=lsqcurvefit(f2,[a0 a1 a2],xi,yi); an, eee=an-[a0 a1 a2] ...y2=x^(3/2)+5; h=ezplot(y2,[0 10]); set(h,'Color','g'); title('chon cac diem giao cua duong'); f=inline( char(y-y2),'x' ); [x0,y0]=ginput; for k=1:length(x0);

Ngày đăng: 01/12/2015, 09:25

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w