Why do I get the error message 'Inner matrix dimensions must agree?

Answers (1)

Read about MATLAB element by element operations. YOu cannot multiply two same vectors using *, you need to multiply element by element, so use . *
%%MBVD
ws=6.37e10;
wp=6.55e10;
qso=1.80e27;
qpo=1.75e27;
Xp=62.06;
f=8e9:5e6:10e9;
w=2*pi*f;
co=w./ws;
c1=w./wp;
d_o=1./qso;
d_1=1./qpo;
do=co*d_o;
d1=c1*d_1;
d2=1-co.^2+1i*do;
d3=1-c1.^2+1i*d1;
op_amp1=Xp*d2;
op_amp2=1i*c1.*d3;
Z_in=op_amp1./op_amp2;
Zin_real=abs(Z_in);
Zin_imag=imag(Z_in);
Zin_phase=-(180/3.142)*atan(Zin_real);
semilogy(f,Zin_real);
%semilogy(f, Zin_real, 'ko', 'MarkerSize', 2)
ylabel('|Z|(Ohm)');
xlabel('Frequency(Hz)');
grid

2 Comments

Ok, i understand and found the problem, thank you very much an have a good day!
Thanks is accepting the answer..:)

Sign in to comment.

Tags

Asked:

on 6 Apr 2018

Commented:

on 7 Apr 2018

Community Treasure Hunt

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

Start Hunting!