%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 Gaim 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)));
Kshitij Singh answered .
2025-11-20
The "Error using + Matrix dimensions must agree" in MATLAB occurs when you try to perform an operation on matrices (or arrays) that have incompatible sizes. Here are some steps to help you resolve this issue:
Check Matrix Dimensions: Ensure that the matrices you are trying to add have the same dimensions. For example, if you have two matrices A and B, they should both be either 2x2, 3x3, etc.
Element-wise Operations: If you want to perform element-wise operations, use the dot operator (.). For example, use A .* B instead of A + B.
Reshape or Resize: If the matrices have different sizes, you might need to reshape or resize one of them to match the other. You can use functions like reshape, resize, or permute to adjust the dimensions.
Use Compatible Functions: Some functions in MATLAB automatically handle operations on matrices of different sizes. For example, sum, mean, and dot can handle operations on arrays of different sizes.