Error, matrix dimension must agree

1 visualización (últimos 30 días)
Ben Louie Yap
Ben Louie Yap el 25 de Abr. de 2020
Respondida: Sampath Rachumallu el 27 de Abr. de 2020
Voc = app.LinetolinevoltageVocEditField.Value;
Ioc = app.LinetolinecurrentAocEditField.Value;
Woc = app.ThreephasepowerkWocEditField.Value/3;
Vsc = app.LinetolinevoltageVscEditField.Value;
Isc = app.LinetolinecurrentAscEditField.Value;
Wsc = app.ThreephasepowerkWscEditField.Value/3;
Vp = app.PrimarysidelinevoltageVEditField.Value;
Vs = app.SecondorysidelinevoltageVEditField.Value;
if(app.StepdowntransformerButton.Value)
a = Vp ./ Vs;
if(app.DeltastarconnectionButton.Value)
Voc = Voc/sqrt(3);
pfoc = Woc/(Voc*Ioc);
if(pfoc>=1)
app.errorTextArea.Value = 'Error! Power factor is more than 1!';
else
Ro = Voc/(Ioc*pfoc);
app.RcTextArea.Value = num2str(Ro);
sineoc = sin(acos(pfoc));
Xm = Voc/(Ioc*sineoc);
app.XmTextArea.Value = num2str(Xm);
Isc = Isc/sqrt(3);
pfsc = Wsc/(Vsc*Isc);
if(pfsc>=1)
app.errorTextArea.Value = 'Error! Power factor is more than 1!';
else
Req = Wsc/(Isc*Isc);
Req = Req/(a*a);
app.ReqTextArea.Value = num2str(Req);
Zeq = Vsc/Isc;
Zeq = Zeq/(a*a);
Xeq = sqrt((Zeq*Zeq)-(Req*Req));
app.XeqTextArea.Value = num2str(Xeq);
end
end
I created 2 edit fields in app designer to allow user to input values into it and the program will calculate the a of it, but for the line a = Vp ./ Vs, it keeps showing matrix dimension must agree and I am running out of idea what should I do since I am still new to Matlab, any kind advices all comments will be appreciated, thanks and sorry for wasting your time!

Respuesta aceptada

Sampath Rachumallu
Sampath Rachumallu el 27 de Abr. de 2020
Here Vp ,Vs are of class 'char' and cannot be divided. So you have to convert them to integer format for division.Try
a = str2num(Vp) ./ str2num(Vs);

Más respuestas (0)

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by