help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script error


From: Marco Atzeri
Subject: Re: Script error
Date: Sun, 18 Mar 2018 16:22:52 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 18/03/2018 14:08, Stefano Milani wrote:
Dear all,

I'm new user of octave and I need an help with this script.

Hi Stefano,


%script per definizione passo fori lamiera

d=6; %Diametro dei fori
p=15; %Passo (da iterare)
p1=p*cos(pi/3); %Passo in direzione assiale (affinchè il pattern sia triangolare equilatero)
r2=622.5; % Diametro Max cono
r1=36; % Diametro Min cono
L=2610; % Lunghezza Lamiera
alpha=atan((r2-r1)/L); %Angolo di semiapertura Cono
rm=(r2+r1)/2; %Raggio medio cono
S=2*pi*rm*L; %Superficie Lamiera
Sforata=0.362*S; %Superficie forata
Nfori=Sforata/(pi*d^2/4); %Numero di fori
n=(L-2*p1)/p1+1;

the problem is here, due to math rounding the
n is not an exact integer as you would expect

octave:21> n=(L-2*p1)/p1+1
n =  347.00
octave:22> n-347
ans =   -5.6843e-14

So you can replace the instruction with:
n=round((L-2*p1)/p1+1);

Best regards

_______________
Stefano Milani

Regards
Marco




reply via email to

[Prev in Thread] Current Thread [Next in Thread]