Question: How do I type the below pseudocode in MATLAB? program First integer i, imin, n
How do I type the below pseudocode in MATLAB?
program First
integer i, imin, n <-- 30
real error, y, x <-- 0.5, h <--1, emin <--1
for i = 1 to n
h <-- 0.25h
y <-- [sin(x+h) - y]/h
error <-- |cos(x) -y|;
output i, h, y, error
if error < emin then
emin <-- error, imin <-- 1
end if
end for
output imin, emin
end program First
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
