Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, i have this hw question for my lab(matlab), i did most of it, but idk why it shows error when i run it, and

Hello, i have this hw question for my lab(matlab),
i did most of it, but idk why it shows error when i run it, and idk how to insert the sentence at the beginning (please select one...),
i would really be grateful if you solved it for me, and i would much appreciate it more if you explain where i went wrong and what did i miss.
Thank you
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Lab Exercise: 1-Write a script that shows the user the following menu: . If the user selects the button (x), the script should print an error message. MATLAB Programming - En Isha Alkandari . If the user selects the button (Area): The script should 1. Ask the user to enter the radius 2- Call the function (getarea) which calculates the area of the circle then calls its subfunction (printarea) to print the result. If the user selects the button (Circum): The script should: 1- Ask the user to enter the radius 2- Call the function (getcircum) which calculates the circumference of the circle then calls its subfunction (printcircum) to print the result. of the user selects the button (Exit), the program stops There should be one script and two functions (with a subfunction for each) to calculate and print the result Command Window Plesse select one option from the menu LEO Please select one option from the menu Enter the raduis: 5 Area of circle - 78.54 Area Cro Please select one option from the menu Enter the raduis! 5 Circumference of circle - 31.12 Please select one option from the menu + WNA 1 menu.m 30 getarea.m getcircum.m 1 2 - mypick = menu('Calculate', 'Area', 'Circum', 'Exit'); 3- Qwhile(true) 4 if (mypick==1) 5 radius = input('Enter radious: '); 6 getarea(radius); 7 pick=menu('Calculate', 'Area', 'Circum', 'Exit'); 8 9 10 elseif(mypick==2) 11 radius = input('Enter radious: '); 12 getcircum(radius); 13 pick=menu('Calculate', 'Area', 'Circum', 'Exit'); 14 15 16 elseif (mypick==3) 17 break 18 19 else 20 disp('Error'); end 22 end 21 22 Command Window >> menu Attempt to execute SCRIPT menu as a function: /Users/afrah/Documents/MATLAB/200LAB/menu.m Error in menu (line 2) mypick menu('Calculate', 'Area', 'Circum', 'Exit'); menu.mx getarea.mx getcircum.mx + 1 function getarea (radius) 2- area = pi * radius^2; 3 - printarea(area); 4- end 5 6 function printarea(area) 7- fprintf('Area of circle = %f', area) 8- end menu.m 1 2 3 4 5 6 7 8 getarea.mx getcircum.mx + e function getcircum(radius) circum = 2 * pi * radius; printcircum(circum); end e function printcircum(circum) fprintf('Circumfrence of circle : %.2f',circum) end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago