フィルターのクリア

MATLAB initial velocity graph

1 回表示 (過去 30 日間)
Blake Sewell
Blake Sewell 2020 年 10 月 14 日
回答済み: Gaurav Chaudhary 2020 年 11 月 3 日
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!!

回答 (1 件)

Gaurav Chaudhary
Gaurav Chaudhary 2020 年 11 月 3 日
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.

カテゴリ

Help Center および File ExchangeVisualization についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by