Professional Documents
Culture Documents
Homework 6
Homework 6
%question 1
clear all;
% r1 x^3+x^2+1=0
r1=roots([1,1,0,1])
% r2 -2x^7+x^5+x^2-4=0
r2=roots([-2,0,1,0,0,1,0,4])
%question 2
clear all;
%A1 code
figure(201);
vo1=5:5:50 %5~50 t
[ta1]=timeofh100(vo1) %ta1X
plot(vo1,ta1);
xlabel('velocity');
ylabel('time');
%A2 code
figure(202);
h2=10:10:100 %10~100
[ta2]=timeofv30(h2) %ta2 X
plot(h2,ta2);
xlabel('height');
ylabel('time');
%B1 code
vo1=5:5:50;
timeofh100= @ (vo1) (-vo1+sqrt(vo1.^2-19.6*100))/9.8
plot(vo1,timeofh100(vo1));
xlabel('velocity');
ylabel('time');
%B2 code
h2=10:10:100;
timeofv30= @ (h2) (-30+sqrt(900-19.6*h2))/9.8
plot(h2,timeofv30(h2));
xlabel('height');
ylabel('time');
t=(v0-sqrt(v0.^2-2*g.*h))./g;