How can I solve this MATLAB “Error using + Matrix dimensions must agree.” ?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Jaydeepkumar Patel
il 11 Lug 2018
Risposto: Jaydeepkumar Patel
il 12 Lug 2018
%Fundamental voltage of the grid IN v1
Vone=690;
%Variable Frequency IN HZ
w=[0.1: 0.1: 1000];
% Angular Frequency IN HZ
omegadot=2*pi*w;
%Rated Frequency f1 IN HZ
omega1=2*pi*60;
%Stator Turns
Ns=1;
%Stator Leakage Inductance IN HENRY
Ls=84.1*10e-6;
%Stator Resistance IN OHM
Rs=7.9*10e-3;
%Magnetizing Inductance IN HENRY
Lm=1.7*10e-3;
%Rotor Speed IN RPM
N=1080;
%RSC Decoupling Gain
Krd=0.00245;
% Transfer funnction signal
s=1i.*omegadot;
%RSC Proportional Gain
Krp=0.052;
%SSC Proportional Gain
Ksp=1.21;
%PLL Proportional Gain
Kpp=44.43;
%DC bus Proportional Gain
Kvp=0.0296;
%Rated Power IN VA
P=3*10e6;
%DC Voltage IN VOLTS
Vdc=1500;
%Rotor Turns
Nr=0.33;
%Rotor Resistance IN OHM
Rr=0.86*10e-3;
%Rotor Leakage Inducatance IN HENRY
Lr=9.21*10e-6;
%SSC Filter Inductance IN HENRY
Lp=63*10e-6;
%Pole Pairs
p=3;
%RSC Decoupling Gain
Ksd=0.025;
%RSC Integral Gain
Kri=0.027;
%SSC Integral Gain
Ksi=2820;
%PLL Integral Gain
Kpi=2791;
%DC Bus Integral Gain
Kvi=1.861;
% Reflected leakage inductance
Lsr=Ls+(Ns.^2/Nr.^2)*Lr;
% Reflected Resistance
R1r=(Ns.^2/Nr.^2)*Rr;
% sys signal function
g=s-1i*60
% Perturbation of Positive Sequ
Pp_s=(s-(1i).*1080)./s;
% Current Compensator function RSC current controller Hri_g
Hri_g=Krp+Kri./g;
% Current Compensator function for phase locked loop Hpll
Hpll_g=Kpp+(Kpi./g)./g;
% phase locked loop Tpll
Tpll_g=-1i.*(Kpp+(Kpi./g))./g/1+(Kpp+(Kpi./g)./g);
%Fundamental voltage of the grid IN v1
Vone=690;
%Rotor Resistance IN OHM
Rr=0.86*10e-3;
% Rotor Current IN AMP
Ir1=Vone./Rr;
% Fundamental voltage of the RSC Terminal in Volts
Vcr=690+Ir1*((1i*60)*(Lsr)+Rs+((R1r)./1i*60));
%positive sequence impedance
H_s=((s.*Lsr+Rs+(R1r./Pp_s))+(Ns^2./Nr^2).*(Hri_g-1i.*Krd)./Pp_s)/(1-(Tpll_g./2).*(Ir1./690).*(Ns.^2/Nr.^2).*(Hri_g-1i.*Krd./Pp_s+(Vcr./690)));
w=[0.1: 0.1: 10^2];
omegadot=2*pi*w;
s=1i.*omegadot;
H_s=((s.*Lsr+Rs+R1r./Pp_s)+(0.8911*((Hri_g)-(1i.*Krd))./Pp_s))/(1-(Tpll_g./2).*(Ir1./690).*(Ns.^2/Nr.^2).*(Hri_g-1i.*Krd./Pp_s+(Vcr./690)));
0 Commenti
Risposta accettata
Walter Roberson
il 11 Lug 2018
Is it deliberate that you are using the Matrix Right Divide operator, /, between two 1 x 1000 vectors? If so, then it is recommended that you document that.
But your basic problem is that you start s and w and related variables out as being 1 x 10000 but later you assign new values to s and w that are only 1 x 1000. You then try to compute as-if all of the variables were consistent size, either 1 x 10000 or 1 x 1000.
If you want to mix sizes like that, 1000 and 10000, then it is highly recommended that you use different variable names for the different sizes and that you break up your long expression into pieces that individually make it clear what their sizes are and that you have specific (commented!) code that does whatever is needed to handle the transition between the two different sizes.
0 Commenti
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Integrated Circuits in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!