From: William on 27 Jul 2010 13:54 Hi, Im working on a projectile motion program. %% angle = input('Enter angle of trajectory= '); %Angle V= input('Enter velocity= '); %Velocity p= input('Enter Position of elevation= '); %Position G= 9.8; %Gravity t=0:0.1:20; %# of Calculations %% h= t*V*cos(angle); %height f= p+t*V*sin(angle) - 1/2*G*t.^2; %flight plot(h,f,'-'); I would like to know how to limit my axes to where the flight begins (p), and when the functions Y value is at zero. Also, how would I go about pausing in between calculations to make it look more like an animation? thanks in advance.
From: us on 27 Jul 2010 14:03 On Jul 27, 7:54 pm, "William " <william.bax...(a)oit.edu> wrote: > Hi, Im working on a projectile motion program. > > %% > > angle = input('Enter angle of trajectory= '); %Angle > V= input('Enter velocity= '); %Velocity > p= input('Enter Position of elevation= '); %Position > G= 9.8; %Gravity > t=0:0.1:20; %# of Calculations > > %% > h= t*V*cos(angle); %height > f= p+t*V*sin(angle) - 1/2*G*t.^2; %flight > plot(h,f,'-'); > > I would like to know how to limit my axes to where the flight begins (p), and when the functions Y value is at zero. Also, how would I go about pausing in between calculations to make it look more like an animation? thanks in advance. one of the solutions plot(1:10,'-rs'); set(gca,'xlim',[-10,20],'ylim',[-20,40]); % and a hint for free... help pause; us
From: William on 27 Jul 2010 14:22 us <us(a)neurol.unizh.ch> wrote in message <b0030537-9cfe-4afa-acb6-7411a3f04a35(a)b5g2000vbl.googlegroups.com>... > On Jul 27, 7:54 pm, "William " <william.bax...(a)oit.edu> wrote: > > Hi, Im working on a projectile motion program. > > > > %% > > > > angle = input('Enter angle of trajectory= '); %Angle > > V= input('Enter velocity= '); %Velocity > > p= input('Enter Position of elevation= '); %Position > > G= 9.8; %Gravity > > t=0:0.1:20; %# of Calculations > > > > %% > > h= t*V*cos(angle); %height > > f= p+t*V*sin(angle) - 1/2*G*t.^2; %flight > > plot(h,f,'-'); > > > > I would like to know how to limit my axes to where the flight begins (p), and when the functions Y value is at zero. Also, how would I go about pausing in between calculations to make it look more like an animation? thanks in advance. > > one of the solutions > > plot(1:10,'-rs'); > set(gca,'xlim',[-10,20],'ylim',[-20,40]); > > % and a hint for free... > help pause; > > us I think i get the idea behind it, but why isnt this working %% h= t*V*cos(angle); %height f= p+t*V*sin(angle) - 1/2*G*t.^2; %flight plot(h,f,'-'); set(gca,'xlim',[0,length(h)],'ylim',[0,length(h)]) %Graphical restrictions % seems like this would allow the x and y axis to change restrictions based on the outcome of its respected x and y equation.
From: us on 27 Jul 2010 14:34 "William " > I think i get the idea behind it, but why isnt this working > > %% > h= t*V*cos(angle); %height > f= p+t*V*sin(angle) - 1/2*G*t.^2; %flight > plot(h,f,'-'); > set(gca,'xlim',[0,length(h)],'ylim',[0,length(h)]) %Graphical restrictions > > > % seems like this would allow the x and y axis to change restrictions based on the outcome of its respected x and y equation. hmm... - why do you use LENGTH(H)... - most CSSMers would probably use MAX(H)... just a thought... us
From: William on 27 Jul 2010 14:53 "us " <us(a)neurol.unizh.ch> wrote in message <i2n8re$je3$1(a)fred.mathworks.com>... > "William " > > I think i get the idea behind it, but why isnt this working > > > > %% > > h= t*V*cos(angle); %height > > f= p+t*V*sin(angle) - 1/2*G*t.^2; %flight > > plot(h,f,'-'); > > set(gca,'xlim',[0,length(h)],'ylim',[0,length(h)]) %Graphical restrictions > > > > > > % seems like this would allow the x and y axis to change restrictions based on the outcome of its respected x and y equation. > > hmm... > - why do you use LENGTH(H)... > - most CSSMers would probably use MAX(H)... > > just a thought... > us %% h= t*V*cos(angle); %height f= p+t*V*sin(angle) - 1/2*G*t.^2; %flight plot(h,f,'-'); set(gca,'xlim',[0,(max(h)/2)],'ylim',[0,(max(f)+5)])%Graphical restrictions With this code I think its odd I need to divide max(h) by 2, and this still doesnt correctly resize my graph with some angles and velocity. The Y max works fine the x-axis is more difficult...I thought perhaps use length for the x values and max for the y, but that did not work either.
|
Next
|
Last
Pages: 1 2 3 4 5 6 Prev: MTech project on Matlab/Simulink in the field of electronics Next: Distribute Matlab figures |