MATLAB initial velocity graph
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have completed the first dot point as follows:
disp ('Initial Velocity')
disp ('Displacement Input')
prompt1= 'Initial displacement (metres): ';
s0 = input(prompt1); %s0=10 metres
prompt2= 'Final displacement (metres): ';
s = input(prompt2); %s=10 metres
prompt3= 'Final time (seconds): ';
t = input(prompt3); %0.8 seconds
v0 = ((s-s0)+(1/2).*(981/100).*t.^2)/t; %initial velocity equation
disp ('Result:')
disp ('Initial Velocity: ')
disp (v0)
However I am stuck on doing the second point, this is my code so far:
s0=10;
s=10;
t = 0.5:0.1:1.5;
v0 = ((s-s0)+(1/2).*(981/100).*t.^2)/t;
plot (v0, t)
Any help is greatly appreciated thank you!!
0 Kommentare
Antworten (1)
Gaurav Chaudhary
am 3 Nov. 2020
Hello,
I understand the issue you are facing where the velocity is not a 1D array. To make velcoity a 1D array please use the dot(.) operator.
For Example:
for the following statement the output is a double datatype
>>v0 = ((s-s0)+(1/2).*(981/100).*t.^2)/t;
V0 can be changed to a 1D array using the following command using dot operator
>>v0 = ((s-s0)+(1/2).*(981/100).*t.^2)/.t;
This should solve the issue you are facing.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Visualization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!