Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The first one is the question and the second one is the sample Work with your group to write an interactive MATLAB program to convert

image text in transcribedimage text in transcribedThe first one is the question and the second one is the sample

Work with your group to write an interactive MATLAB program to convert a yard stick to a meter stick. The program should plot the results in a graph, and interact with user by requesting the input in inches (a yard stick is 36 inches), convert the input into centimeters (1 inch = 2.54 cm), and mark it on the plot with 'o'. Create a new M-file in your Current Folder, name it as Li_GA.m, and write comments for each line of code. After you save and run the M-file, you should have a plot similar to Fig. 1-9 40 35 30 25 yard stick (in) 20 15 101 5 o 20 80 40 60 meter stick (cm) 100 To perform this exercise, copy and paste the following code, exactly as it is, into a new M-file, and name it L1 Exercise_5.m. % program to convert Celsius temperature to Fahrenheit temperature clear; clf; % clears figure $ Create variable tempc to be used as an argument in the mathematical % function for Fahrenheit temperature tempf as a function of tempo tempc = linspace(0, 100, 20); tempf = 9/5* tempc+32; % plot the function plot (tempc, tempf) xlabel('Temperature in degrees C','fontsize', 18) ylabel('Temperature in degrees F','fontsize', 18) set (gca,'fontsize', 18); grid on % request user to specify temperature in Centigrade and wait for input hold on tempo = input('What is the temperature in Centigrade?...'); tempf = 9/5* tempc+32; % convert input into Fahrenheit tempf % print results on command window plot(tempc, tempf,'o') % mark it on the plot with 'o' After you save and run the M-file, you should have a plot similar to Fig. 1-7, and the following lines will appear in your prompt window: >> L1_Exercise_5 What is the temperature in Centigrade?... 250 250 200 200 150 150 Temperature in degrees F Temperature in degrees F 100 100 X 5 Y 41 50 50 0 0 0 20 40 60 80 100 Temperature in degrees C Fig. 1-7: Results in Exercise 5 before user input 20 40 60 80 100 Temperature in degrees C Fig. 1-8: Results in Exercise 5 after user input

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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

What is job enlargement ?

Answered: 1 week ago

Question

3. Did you seek anyones advice?

Answered: 1 week ago

Question

7. What traps should she avoid?

Answered: 1 week ago

Question

5. What decision-making model would you advocate to this person?

Answered: 1 week ago