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

This script must be done in matlab and it states I need to create a script that

ID: 3765631 • Letter: T

Question

This script must be done in matlab and it states I need to create a script that has the following components... 1.must contain at lease three functions (at least two must accept parameter inputs), 2. input from the user, 3. output in graphs, 4. "if" or "switch" statements, 5. "for" or "while" statements.

I want to do something that pertains to small arms or ballistics. I made the following function that calculates recoil in ft/lbs, but I am lost on what to do and add from here. Does anyone else have any ideas? My script below seems useless since it would be almost impossible to calculate time to the target.

I'm honestly about to give up on calculating the recoil and try something else. Any idea or suggestions from you Matlab experts out there? If so please can you give me script that you think would work, or just the basis of one.


function free_recoil
u=input('enter units for distance');
if u ==~ 'ft'  
disp('please only use meters');
end
end

function velocity
d=input('Distance to target');
t=input('time to target');
V=d/t;
FPE(V)
end

function FPE(V)

clear

global M P W

M=input('weight of the projectile in grains:');

P=input('weight of powder charge in grains:');

W= 0:0.1:10;

Free_Recoil_Energy_in_FPE=((M.*V + 4700.*P)./7000).^(2)./(64.34809711)./(W)

if Free_Recoil_Energy_in_FPE <0, disp('error, not possible in the real world')

end

plot(W,Free_Recoil_Energy_in_FPE)

xlabel('Weight of Firearm in Pounds');

ylabel('Recoil in ft/lbs');

end

Explanation / Answer

Answer:

%MATLAB SCRIPT TO FIND THE RECOIL ENERGY

function getP

global P,M

M=input('weight of the projectile in grains:');

p=input('weight of powder charge in grains:');

end

function getMuzzleVelocity

global mv

d=input('Distance to target');

t=input('time to target');

mv=d/t;

end

function calculateRecoilVelocityEnergy

global P,M,mv

FRE=0;

FRV=0;

w1=[];

W=0;

energy=[];

for W=0:0.1:10

FRV= ((1.75.*P)+M)*.mv)./(7000*.W));

FRE= (FRV*.FRV*.w)./64.4;

if FRE <0

disp('error notpossible');

end

w1 (end+1)= W;

energy (end+1)= FRE;

end

plot(w1,energy)

xlabel('Weight of Firearm in Pounds');

ylabel('Recoil in ft/lbs');

end

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