problem plotting complex function

5 views (last 30 days)
Hi everybody! i don't understand why, plotting the complex function eps_compl, separating imag and real part, i obtain always a costant value in frequency, when it should vary with frequency. Besides i'd like to work with a larger range of frequency but it gives me the error "Maximum variable size allowed by the program is exceeded."
the program is this, (i->i^2=-1)
sigma=0.05;
eps_inf=4.0;
eps_cero=8.842*10^(-12);
delta_eps=[47.0 3500 2.5*10^5 3*10^7];
tau=[7.96*10^(-12) 198.94*10^(-9) 79.58*10^(-6) 4.547*10^(-3) ];
alfa=[0.1 0.22 0.22 0];
w=10:.05:10^2;
slen=length(w);
eps_compl=zeros(slen);
for q=1:slen
for k=1:4
eps_compl=sigma/(i*w(q)*eps_cero)+eps_inf+(delta_eps(k)/(1+(i*w(q)*tau(k))^(1-alfa(k))));
end
end
figure(1);
subplot(211); plot(w,real(eps_compl)); title('real impedence');
subplot(212); plot(w,imag(eps_compl)); title('imaginary impedence');
Thank you!

Accepted Answer

Mohsen  Davarynejad
Mohsen Davarynejad on 11 Dec 2011
The problem is that eps_compl is just a single number, and not an array. You compute eps_compl for every point, but you do not store them. Assign sapce to eps_compl by something like:
eps_compl = ones(q,k) % if the size of eps_compl is q*k
and in your for loop add something like this:
eps_compl(q,k) = ...

More Answers (0)

Categories

Find more on 2-D and 3-D Plots 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!