Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem #1 The sum of the 1-D moments using a for loop In statics, the sum of mo

ID: 2248854 • Letter: P

Question

Problem #1 The sum of the 1-D moments using a for loop In statics, the sum of moments applied on an object must be zero. Let the ith moment be defined as: mi = Fidi Where Fi is the ith force, di is the distance of Fi from the center of gravity and mi the ith moment caused by F For the body to be static (not rotating), the sum of the moments must be zero which is expressed as: Write a program in MATLAB that will take the number of forces as input. Then it will go through a for loop for each force. Within the for loop, Matlab will ask the user to enter the value of the forceFi and the distance from the center of gravity di. Then it will iteratively calculate it corresponding moment mi and then Matlab will add it to the sum_moment. Once the for loop is exited, display the sum using disp command. Submit the script as.m file HINT: Use the for loop example in class, that summed the forces as a guideline. Now you need to add the distance and calculate m before adding to to sum_moment.

Explanation / Answer

Ans) =============MATLAB CODE=============


N=input('Enter no of Forces:');
sum_moment=0;
for i=1:N
  
F(i)=input('Enter Force value:');
d(i)=input('Enter distance of that Force from center of gravity:');
m(i)=F(i)*d(i);
sum_moment=sum_moment+m(i);
  
end

disp(sum_moment)

===========================

Output in command window as below when you run

==

>> SumOfMoment
Enter no of Forces:3
Enter Force value:1
Enter distance of that Force from center of gravity:0.5
Enter Force value:2
Enter distance of that Force from center of gravity:5
Enter Force value:6
Enter distance of that Force from center of gravity:3
28.5000

>>

===============

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote