MATLAB help? ;/ im so lost You're driving to California, and start at a green light at a velocity of 0 mph. Every two seconds your velocity increases by 5 mph. You will reach a maximum velocity at t=60 seconds. a. Create an array for time and an array for velocity. b. Plot the velocity vs. time and label the axes.
It says I have use some pseudo code first.. what's that mean?
your velocity is off
pseudo (false) code is just the main ideas written in "code" but without attention to syntax or specific function calls
I have this document to help.. but I'm not sure which one to go off from to help me.
5 will not work either
6?
5/2
you should use the idea that Velocity= V0 (start velocity)+ A*t where A is the acceleration they tell you acceleration is 5 mph/ 2 sec
I have to use a pseudo code first , but im not sure what or how to do that. Are pseudo codes the codes that are in the pdf I just uploaded ?^
pseudo code is close to this Define acceleration a=5/2 make t an array of time t=0:60 let V (velocity) be 0 + a*t plot(t,V) label the axes
Example A= 5/2; % acc in mph per second t= 0:60; % for 60 seconds V= A*t; % find the velocity as a function of time plot(t,V,'.'); xlabel('TIME (sec)'); ylabel('Velocity (mph)'); grid on; shg
You could use example (2). I have a quibble with it, in that you should not use i as a variable name. i is pre-defined as sqrt(-1) and if you get into the habit of redefining i (which is what happens when you use it as a variable), someday with will make a mistake... but you could do this a= 5/2; n= 60; t= 0:n; v= zeros(size(t)); % create a vector v to hold the answer for ii=0:n v(ii+1)= a*t(ii+1); end; and then plot it
okay, I'll try it out. THANK you so much :)
Join our real-time social learning platform and learn together with your friends!