Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Matlab convert script to function

I wrote my script for a class but the next step is to convert that script into a function. What do I type in? This is my script:
% Find max volume

b = 2.75; %ft for diameter
h = 3.00; %ft for height

v = (b*h)/3; %ft^3
% use volume to find mass
p = 62.3;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

m = p*v;

>Solution :

maxVolume(2.75, 3.0, 62.3)

function m = maxVolume(b, h, p)
    v = (b * h)/3;
    m = p * v;
end
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading