Question
can anyone help me figure out how fo write matlab code for these problems?
BME 2013 Spring 2019 Exam 3 Matlab Review Sheet 1. Given the vector of patient body temperatures T (98.6, 102, 101, 99,98.9,
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Done accordingly. Please comment for any problem. Please Uprate. Thanks.

fever.m

prompt = 'Please give vector of temperatures. ';
T = input(prompt);
index=1;
haveFever=0;
noFever=0;
while index <= length(T)
if T(index) >= 99
haveFever=haveFever+1;
else
noFever=noFever+1;
end
index=index+1;
end
fprintf('%d persons have fever and %d persons dont have fever\n',haveFever,noFever);

Output:

>> fever Please give vector of temperatures. [98.6,102,101, 99,98.9,102.1,100.3,101.2] 6 persons have fever and 2 persons don

areas.m

choice=1;
while and(choice>0,choice <4)
prompt = 'Please choose for which you want to calculate area\n1)Cylinder\n2)Circle\n3)Rectangle\n4)Any other to exit.\n';
choice = input(prompt);
if choice==1
r = input('Enter Radius of Cylinder :');
h=input('Enter height of Cylinder :');
area = (2*pi*r*h)+(2*pi*r^2);
fprintf('Area of Cylinder = %0.3f\n', area);
elseif choice==2
radius = input('Enter Radius of Circle');
area = pi * radius^2;
fprintf('Area of Circle = %0.3f\n', area);
elseif choice==3
length = input('Enter Length of Rectangle :');
width=input('Enter width of Rectangle :');
area=length*width;
fprintf('Area of Circle = %0.3f\n', area);
end
  
end

Output:

>>areas Please choose for which you want to calculate area 1) Cylinder 2) Circle 3) Rectangle 4)Any other to exit. Enter Radi

Add a comment
Know the answer?
Add Answer to:
BME 2013 Spring 2019 Exam 3 Matlab Review Sheet 1. Given the vector of patient body temperatures ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem: Given information about a circle, rectangle and a triangle, calculate the area of the shape...

    Problem: Given information about a circle, rectangle and a triangle, calculate the area of the shape from the information supplied. Write pseudocode to solve this problem and write a Python program that asks the user to input the required information for a shape and then calculates the area of the shape. Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT