which my mistake erro

1 visualización (últimos 30 días)
Miguel Amor Rodriguez Avelino
Miguel Amor Rodriguez Avelino el 12 de Mayo de 2022
Respondida: Steven Lord el 13 de Mayo de 2022
% TRANSFORMADOR MONOFASICO DE DOS DEVANADOS
%ARCHIVO: EFICIENCIA_I
Re=0.0276; %input('Resistencia equivalente por el lado de baja (Ohm) Re''=');
V2= 120; %('Voltaje a aplicar a la carga (V) V2=');
Pmag=180; %('Pérdidasmagneticas (W) Pmag=');
In= 1.125;%('Corriente Nominal (A)In=');
I2=0:2:1.2*In;
FP=[ 0.8 0 0.1 ];
for J=1:length(FP)
for I=1:length(I2)
Pel=I2(I).*I2(I)*Re;
Ef(I,J)=V2*I2(I).*FP(J)./(V2*I2(I).*FP(J)+Pmag+Pel)*100;
end
end
plot(I2,Ef,'-*')
title('Eficienciavs I2')
grid on
xlabel ('Corriente por el secundario (A)');
ylabel('Eficiencia (%)');
legend(' FP=0.8','FP=0.5','FP=0.1')
set(gca,'color',[1 1 0.7])
set(gca,'XGrid','on','YGrid','on')
[EfmaxIter]= max(Ef);
I2me=I2(Iter);
  1 comentario
dpb
dpb el 12 de Mayo de 2022
...
[EfmaxIter]= max(Ef);
I2me=I2(Iter);
Well, there is no variable 'Iter' in sight here --- the only thing I see with "Iter" as part of a variable name is the previous returned max value of something called 'Ef' which is not likelyh to be what you want...but we don't know what you intend it to be...

Iniciar sesión para comentar.

Respuestas (2)

Steven Lord
Steven Lord el 13 de Mayo de 2022
I suspect that you want those last two lines to be:
[Efmax,Iter]= max(Ef);
I2me=I2(Iter);
in order to set I2me to the value of I2 in the same location that the maximum value is in Ef, instead of
[EfmaxIter]= max(Ef);
I2me=I2(Iter);

Miguel Amor Rodriguez Avelino
Miguel Amor Rodriguez Avelino el 12 de Mayo de 2022
I intend to graph the power factors
  3 comentarios
Miguel Amor Rodriguez Avelino
Miguel Amor Rodriguez Avelino el 12 de Mayo de 2022
I don't understand what you are saying can you explain more please
dpb
dpb el 12 de Mayo de 2022
I don't know how we can explain your intent -- the problem is you used a variable named "Iter" in the line that threw the error but you didn't define it -- it doesn't exist which is what the error message is telling you.
But, we don't know what your intent was in writing that line of code; we didn't write it nor have you explained what you might be thinking it should do.
As far as plotting, it appears you created an array by three columns for Ef; maybe the intent was to iterate over those and plot one column at a time? Tthat may be so, and would seem to probably be the intent at some point, but it still doesn't give much of a hint of what that particular line is intended to do.
If you don't understand the intent, I'm guessing this is code you got from somebody/somewhere else and didn't write yourself? In that case, your best bet is to go to the source and ask them...
We're also somewhat hampered because you pasted images of incomplete code so we can't see what else is there nor can we do anything with it -- insert the full text of the code as text an use the CODE button to format it legibly for there to be any chance anybody can guess anything else. If it requires input data to run the function, then attach it also.

Iniciar sesión para comentar.

Categorías

Más información sobre Time Series Events 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