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

MATLAB BASIC CODE QUESTION Can you write a code for me? 1.The monthly payment M

ID: 2085475 • Letter: M

Question

MATLAB BASIC CODE QUESTION

Can you write a code for me?

1.The monthly payment M of a loan amount P for y years and with interest rate r can be calculated by the formula:

Write a program that calculates the monthly payment for a $100,000 loan for 30 years using a 5% interest rate. Repeat the problem (calculate the monthly payment) for a 3% interest.

(I got 77032.386703 and -23549.707688. I know I did something horribly wrong but I have another small question.

do I put 0.03 for r or 3 for the r?)

2.The wind chill temperature, Twc, is the air temperature felt on exposed skin due to wind. In US customary units it is calculated by:

TWC=35.74 + 0.6215T - 35.75v0.36 + 0.4275Tv0.16

where T is the temperature in degrees F and v is the wind speed in mi/h. Write a Matlab program that calculates Twc. The program must define T equals to 30ºF and v=42 mi/h.

3.Write a program that calculates the dew point temperature (Td) and relative humidity (RH) for given dry-bulb (T) and wet-bulb temperatures (Tw) and barometric pressure (psta). The dew point temperature and the relative humidity RH can be calculated from the dry-bulb T and wet-bulb Tw temperatures according to the following equations

where temperatures are given in degrees Celsius, RH is in %, and psta is the barometric pressure in units of millibars. Use the following information to solve this problem,

T=25°C, Tw=19°C, psta=985 mbar

4.The Karvonen formula is one method for calculating the training heart rate (THR).

THRN=[(220-AGE)-RHR]*INTERN+RHR

where AGE is the age (years), RHR the rest heart rate, and INTERN is the fitness level (0.55 for low, 0.65 for medium, and 0.8 for high fitness level). Write a script file that determines the THR.

The program then displays the training heart rate using an fprintf command (The training heart rate for a XXX old individual with a rest heart rate of XXX is XXX.). Please note that the resting heart rate range anywhere from 40 to 100 beats per minute.

12 M= 12) 12

Explanation / Answer

1)   clc;
clear all;
close all;
p=input('enter loan amount :');
y=input('enter the time in years:');
r=input('enter the interest rate:');
M=(p*(r/12))/(1-(1+(r/12))^(-12*y));
X = sprintf(' monthly payment is %f.',M);
disp(X);

2)clc;
clear all;
close all;
T=input('enter the temperature in F :');
V=input('enter the wind speed in mi/h :');
TWC=35.74+(0.6215*T)-(35.75*V*0.36)+(0.4275*T*V*0.16);
X = sprintf(' windchill temperature is %f.',TWC);
disp(X);

3) clc;
clear all;
close all;
t=input('enter the dry bulb temperature in degrees :');
tw=input('enter the wet bulb temperature in degrees :');
Psta=input('enter the barometric pressure in mbar :');
eS=6.112*exp((17.67*t)/(t+243.5));
ew=6.112*exp((17.67*tw)/(tw+243.5));
e=ew-(Psta*(t-tw)*0.00066*(1+0.00115*tw));
RH=100*(e/eS);
Td=(243.5*log(e/6.112))/(17.67-log(e/6.112));
X = sprintf(' the dew point temperature is %f.',Td);
disp(X);

4) clc;
clear all;
close all;
AGE=input('enter the age in years :');
RHR=input('enter resting heart rate in beats per minute :');
x=input(' choose the fitness level low or medium or high:','s');
low=1;
medium=2;
high=3;
if x==1
k=0.55;
elseif x==2
k=0.65;
else
k=0.8;
end
THRN=((220-AGE)-RHR)*k+RHR;
X = sprintf('the training heart rate for a %s old individual with a rest heart rate of %d is %f.', AGE,RHR,THRN);
disp(X);