I am trying to find resultant force through inputs of magnitude and direction, I am first required to input how many data sets 1-10. I can get my program to repeat but whatever is the last input for both my magnitude and direction just overwrites the other inputs I had just put in for them. How do I make it so that each inut pair of magnitude and direction can be used to find their own corresponding resultant force?

4 件のコメント

Ajay Kumar
Ajay Kumar 2020 年 3 月 22 日
Can you briefly explain how do you enter inputs and how you want the expected output?
Marshall Cook
Marshall Cook 2020 年 3 月 22 日
u=menu('What is your unit system?','SI','English');
d=input('Enter Number of Data Sets 1-10');
while d<1||d>10
disp('Error')
d=input('Enter Number of Data Sets 1-10');
end
n=[1:1:d];
for c=1:d
m=input('Enter Magnitude of Force:');
while m<0||m==0
disp('Error')
m=input('Enter Magnitude of Force:');
end
a=input('Enter Angle of Force:');
while a<0||a>360||a==360
disp('Error')
a=input('Enter Angle of Force:');
end
end
This is what I have so far
Marshall Cook
Marshall Cook 2020 年 3 月 22 日
I want to take the inputs to find the resultant forces in the X and Y plane then calculate the total resultant force of all the total number of resultants combined
Ajay Kumar
Ajay Kumar 2020 年 3 月 23 日
check answer

サインインしてコメントする。

 採用された回答

Ajay Kumar
Ajay Kumar 2020 年 3 月 23 日

0 投票

You are replacing the m and a everytime in the for loop. try this
u=menu('What is your unit system?','SI','English');
d=input('Enter Number of Data Sets 1-10');
while d<1||d>10
disp('Error')
d=input('Enter Number of Data Sets 1-10');
end
n=[1:1:d];
for c=1:d
m(c)=input('Enter Magnitude of Force:');
while m(c)<0||m(c)==0
disp('Error')
m(c)=input('Enter Magnitude of Force:');
end
a(c)=input('Enter Angle of Force:');
while a(c)<0||a(c)>360||a(c)==360
disp('Error')
a=input('Enter Angle of Force:');
end
end
Now you can use datasets of m and a to calculate total resultant force.

1 件のコメント

Marshall Cook
Marshall Cook 2020 年 3 月 23 日
Thank you this was a huge help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Introduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by