Thu 13 Feb 2014 11:03:43 PM UTC, comment #4:
Yep sure, that's the same script which causes the panic. I know my octave is not the latest version, but looks like i have to wait for MacPorts to update their repositories to get it. I remind that i use octave 3.6.4 on Mac OS 10.6.8 installed through MacPorts
I also attach the complete output of my terminal while executing the script.
(file #30546)
|
Wed 12 Feb 2014 11:43:48 AM UTC, original submission:
Hello everyone. I am an engineering student and i use octave for solving exercises. Today i executed some (wrong) code, but rather than telling me what's wrong octave just panics and quits. here's the code:
clear
clc
clf
x=linspace(-2.pi,2.pi,1000);
nodi=linspace(-2.pi,2.pi,11)
f=@(x) sin(1./(1+x.^2));
X=nodi;
Y=f(nodi);
P=polyfit(X,Y,10)
figure(1)
plot(x,f(x),x,polyval(P,x),nodi,f(nodi),'o')
grid on
err=max(abs(f(x)-polyval(P,x)))
n=[4,8,10];
for k=1:length(n)
distcheb=1:pi./n(k):pi;
nodicheb=cos(distcheb);
X=nodicheb;
Y=f(nodicheb);
P=polyfit(X,Y,n(k)-1);
figure(k+1)
plot(x,f(x),x,polyval(P,x),nodicheb,f(nodicheb),'o')
grid on
err(k)=max(abs(f(x)-polyval(P,x)));
end
err
I found that the issue happens with the line
distcheb=1:pi./n(k):pi;
Again i got the mistake, but why does octave panic on such a line instead of displaying an error?
|