Help with building an Iteration function
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
function [out] = iteration(N)
if N<1
error('Input must be >0')
end
x(1)=4;
for k=1:N
x(k+1)=1+(0.5*sin(k)); %#ok<AGROW>
end
disp('The elements stored in x are:')
disp(x)
fun=@(x)1+(0.5*sin(x));
xz=fzero(fun,2);
disp('The zero given by xz is:')
disp(xz)
out=abs(xz-x);
disp('v=')
disp(out)
Hi, Above is my code so far however it doesn't work for the fzero part and shows v as NaN and also for the last part, I have no idea what to do
Any suggestions are appreciated :)
2 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Functions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!