Question: this is matlab. The code is below but it does not satisfy all the assessments. I need u to fix the code so all the
this is matlab. The code is below but it does not satisfy all the assessments. I need u to fix the code so all the assessments are satisfied.



Display output with fprintf 1 solution submitted (max: 2) View my solutions Given a two-row matrix monthly deposit and years, write a code that displays the output as shown below. The monthly deposit will be $XXXX.XX in XX years. Hint: Use the vectorized fprintf Even if the grader marks as if your answer is correct, check your displayed out with the following carefully and try on your own MATLAB until you obtain exactly the same output The monthly deposit will be $1495.00 in 5 years The monthly deposit will be $1218.00 in 6 years The monthly deposit will be $1020.60 in 7 years The monthly deposit will be $872.78 in 8 years The monthly deposit will be $758.13 in 9 years The monthly deposit will be $666.67 in 10 years For validating your code, assign your fprintf command line to the variable out_fprintf as shown below: out_fprintf = fprintf( your command); Function C Reset MATLAB Documentat 1 function out_fprintf = monthlydeposit(mon_yrs) 2 3 out_printf = fprintf('The monthly deposit will be $%.2f in %d years ',mon_yrs) %there shoud be only 1 next line 4 end 5 6 Code to call your function CR 1 mon_yrs=[1495.00 1218.00 1020.60 872.78 758.13 666.67;5:10]; 2 out_fprintf=monthlydeposit(mon_yrs); Output The monthly deposit will be $1495.00 in 5 years The monthly deposit will be $1218.00 in 6 years The monthly deposit will be $1020.60 in 7 years The monthly deposit will be $872.78 in 8 years The monthly deposit will be $758.13 in 9 years The monthly deposit will be $666.67 in 10 years out_printf = 286 Output argument "out_fprintf" (and maybe others) not assigned during call to "monthlydeposit". Previous Assessment: 0 of 2 Tests Passed Your code returns the correct output for the given data. Variable output has an incorrect value. Check if your text string is exactly same as the sample output (spacing, upper and low case, changing the lines, conversion specifier, and so on). Your code returns the correct output for the data different from the given ones. Variable output has an incorrect value. It seems you have made your output hard coded instead of vectorizing with the given vector input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
