English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

for n=1
poly=polyfit(x,y,n)
z=polyval(poly,x)
e=x-z
norm=max(e)
if norm>0.00005
n=n+1
end
end

all i want to happen is that after n=1 gets calculated, if norm>0.00005 to do n=n+1=2 and keep going until norm<0.00005.

note: x and y have been defined previously (not shown).

2006-09-21 03:50:49 · 2 answers · asked by Tony L 1 in Computers & Internet Programming & Design

2 answers

well i have no idea what MATLAB is, but i am a programmer and i see a major mistake for a for loop. its this....
for(n=1).....you have to put the calculation or test for true false in parentheses

2006-09-21 03:55:06 · answer #1 · answered by inhisname155 2 · 0 0

This page has an example that shows what you are doing wrong.
You also do not need to increment n!

2006-09-21 11:06:59 · answer #2 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers