octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #41566] Bus Error

 From: anonymous Subject: [Octave-bug-tracker] [bug #41566] Bus Error Date: Wed, 12 Feb 2014 11:43:49 +0000 User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:27.0) Gecko/20100101 Firefox/27.0

```URL:
<http://savannah.gnu.org/bugs/?41566>

Summary: Bus Error
Project: GNU Octave
Submitted by: None
Submitted on: Wed 12 Feb 2014 11:43:48 AM UTC
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Crash
Status: None
Assigned to: None
Originator Name: Michele Riva
Open/Closed: Open
Discussion Lock: Any
Release: 3.6.4
Operating System: Mac OS

_______________________________________________________

Details:

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?

_______________________________________________________

<http://savannah.gnu.org/bugs/?41566>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```