help-octave
[Top][All Lists]
Advanced

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

Plotting problem after for-endfor roop


From: okayasu
Subject: Plotting problem after for-endfor roop
Date: Thu, 15 Mar 2012 00:11:01 -0700 (PDT)

I've just started to learn octave.
The following code calculates a resistive-wall impedance
that depends on a accelerator resonance frequency.

Calculation results; frequencies and impedances are properly written
in a file named "test.dat".
However, plotting results seem to represent last few lines or one line.
Could anybody suggest me that how to solve this issue ?

Thanks,
Okayasu

### octave macro (named test.m) from here ###
#General constants
c=2.99E+8;
ep0=8.85E-12;
#Conditions
#b: Bore radius
#d: duct thickness
b=8.0E-3;
d=2.0E-3;
#SUS316L
sigma=1.4E+6;
mu0=1.25E-6;

fid=fopen("test.dat","w");
for j=0:0.1:15
omega=10^j;
delta=sqrt(2/sigma/mu0/omega);
lam=(i+sign(omega))/delta;
c1=real(lam*b);
c2=real(lam*(b+d));
alp1=(besselj(1,c1)*bessely(0,c2)-bessely(1,c1)*besselj(0,c2))/(besselj(0,c1)*bessely(0,c2)-bessely(0,c1)*besselj(0,c2));

z_pal=-i/(2*pi*ep0*b*c*((omega/lam/c+lam*c/omega)*alp1-b*omega/2/c));

fprintf(fid,"%8.6e %8.6e %8.6e %8.6e\n",omega,delta,imag(z_pal),abs(z_pal));
endfor
fclose(fid);
loglog(omega,abs(z_pal));
### octave macro (named test.m) to here ###

--
View this message in context: 
http://octave.1599824.n4.nabble.com/Plotting-problem-after-for-endfor-roop-tp4474086p4474086.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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