how can i add more multiple curves
Show older comments
syms m h v0 alpha alp time x(t) y(t) t xn xn2;
m=input('Nhap m: ');
h=input('Nhap h: ');
v0=input('Nhap v0: ');
time=input('Nhap time: ');
dvgoc=input('Chon don vi goc (1:rad, 2:deg): ');
if (dvgoc==1)
alpha=input('Nhap goc nem (Rad): ');
elseif (dvgoc==2)
alpha=input('Nhap goc nem (Deg): ');
alpha=alpha*pi/180;
elseif (dvgoc==2)
end
Dx=diff(x);
D2x=diff(x,2);
x(t)=dsolve(m*diff(D2x)==-h*diff(Dx),x(0)==0,Dx(0)==v0*cos(alpha),D2x(0)==0);
disp('x(t)=');
pretty(x(t));
disp(x(t));
Dy=diff(y);
D2y=diff(y,2);
y(t)=dsolve(m*diff(D2y)==-m*9.8-h*diff(Dy),y(0)==0,Dy(0)==v0*sin(alpha),D2y(0)==-9.8);
disp('y(t)=');
pretty(y(t));
disp(y(t));
%Ve do thi
xn=input('Ban muon ve do thi khong(C/K): ','s');
disp(' ');
if xn=='c' || xn== 'C'
disp('3. Ve do thi quy dao chuyen dong:'),disp('');
fplot(subs(x(t)), subs(y(t)), [0 time]);
while xn=='c' || xn== 'C'
xlabel('x(t)');
ylabel('y(t)'); grid on; shg;
xn=input('Ban muon ve do thi voi gia tri alpha khac khong(C/K): ','s');
if xn=='c' || xn== 'C'
if (dvgoc==1)
alpha=input('Nhap goc nem (Rad): ');
elseif (dvgoc==2)
alpha=input('Nhap goc nem (Deg): ');
alpha=alpha*pi/180;
end
xn2=input('Ban muon giu lai do thi cu khong (C/K): ','s');
if xn2=='c' || xn2== 'C'
hold on;
elseif xn2== 'k' || xn2== 'K'
hold off;
end
fplot(subs(x(t)), subs(y(t)), [0 time]);
end
end
end
How can i add more curve in this code
1 Comment
A
on 1 Dec 2022
Answers (0)
Categories
Find more on Just for fun in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!