How to make variable plotting range?

1 view (last 30 days)
Gennady Kozyukin
Gennady Kozyukin on 18 Feb 2015
Edited: Gennady Kozyukin on 18 Feb 2015
Have no problem to plot this one:
Z_1 = 5;
A_1 = 10.81;
Z_2 = 14;
A_2 = 28.085;
d_2 = 2;
E_0_1 = 10;
Q_d = 1e15;
a_m = 2;
E_0 = E_0_1*1000;
N_a = 6.022e23';
M_1 = A_1/(1000*N_a);
M_2 = A_2/(1000*N_a);
N_s = (d_2*N_a)/A_2;
a_c = a_m/10000;
t_s = t_h*60*60;
m_u = M_2/M_1;
r_e = Z_1.^(1/6);
k_e = 0.121e-15 * Z_1 ^ (0.7e1 / 0.6e1) * Z_2 * (Z_1 ^ (0.2e1 / 0.3e1) + Z_2 ^ (0.2e1 / 0.3e1)) ^ (-0.3e1 / 0.2e1) * A_1 ^ (-0.1e1 / 0.2e1);
syms E;
S_e = k_e*sqrt(E);
S_n = 0.28e-14 * Z_1 * Z_2 * A_1 * (Z_1 ^ (0.2e1 / 0.3e1) + Z_2 ^ (0.2e1 / 0.3e1)) ^ (-0.5e0) / (A_1 + A_2);
R = int((1/N_s)/(S_e+S_n),0,E_0);
Rp = vpa(R/(1+(1/3)*m_u),10);
delta_Rp = Rp*(2/3)*(A_1*A_2).^(0.5)/(A_1+A_2);
Rl = (R.^(2)-Rp.^(2)).^(0.5);
delta_Rl = vpa((Rl*2.^(-0.5)),10);
I_max = Q_d/((2*pi).^(0.5)*delta_Rp);
N = vpa(Q_d * exp(-(x - Rp) ^ 2 / delta_Rp ^ 2 / 0.2e1) * (erfc((y - a_c / 0.2e1) * sqrt(0.2e1) / delta_Rl / 0.2e1) - erfc((y + a_c / 0.2e1) * sqrt(0.2e1) / delta_Rl / 0.2e1)) * sqrt(0.2e1) * pi ^ (-0.1e1 / 0.2e1) / delta_Rp / 0.4e1,10);
ezsurf(N, [0 1e-5 ], [-2/10000 2/10000]);
But when I change the code to:
ezsurf(N, [0 10*Rp ], [-a_c a_c]);
I got an error!
And if I do something like this, it's ok:
Rp_1=1e-6; a_c_1=2e-4;
ezsurf(N, [0 10*Rp_1 ], [-a_c_1 a_c_1]);
It's my 1-st time with Matlab, so maybe I don't understand few simple things...

Answers (1)

Gennady Kozyukin
Gennady Kozyukin on 18 Feb 2015
Edited: Gennady Kozyukin on 18 Feb 2015
Rp_1=double(Rp); a_c_1=double(a_c);
Solve the problem!!!

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!