MATLAB initial velocity graph
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Gaurav Chaudhary
le 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 commentaires
Voir également
Catégories
En savoir plus sur Visualization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!