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

Formatted output: Centripetal force 2Tur m: mass, V: velocity, r: orbit radius,

ID: 3573003 • Letter: F

Question

Formatted output: Centripetal force 2Tur m: mass, V: velocity, r: orbit radius, F: centripetal force, T: period of motion, w: ar velocity, a: angular acceleration, f: frequency Write a Matlab program that calculates the centripetal force of a body that makes a circular motion. Also calculate the period of the motion and angular velocity of the body. Note that any of the input arguments (mass, velocity, and orbit radius) can be arrays (matrices). All non-scalar input arguments should have the same dimension. Your program must check the sizes of the arrays, and give an error message and stop if they are incompatible. Note that any of the input arguments can be scalar. All input values must be positive. If not, your function should give an error message and stop. Make sure that the results are displayed on the screen with the format shown in the following samples.

Explanation / Answer

m = input('Enter the value(s) for the mass (kg)         :');
v = input('Enter the value(s) for the velocities (m/s) :');
r = input('Enter the value(s) for the orbit radius (m) :');

for i=1:size(m,1)
    if m[i]<=0
        disp('Mass contains atleast one non-positive value.');
        disp('End run');
        break;
    end
end
%sanity checks
if size(m)~=size(v) || size(v)~size(r)
    disp('The size of the input argument arrays are incompatible.');
    disp('End run');
else
    disp('        m        V        r        T        w');
    disp('--------- -------- -------- -------- --------');
    for i=1:size(m,1)
        w = v[i]/r[i];
        a = w*w*r;
        F = m*a;
        T = 2*pi/w;
        disp([num2str(m[i])+' '+num2str(v[i])+' '+num2str(r[i])+' '+num2str(F)+' '+num2str(T)+' '+num2str(w)]);
    end
end