フィルターのクリア

How to update new value in next iteration?

3 ビュー (過去 30 日間)
Light
Light 2013 年 5 月 26 日
How can i update that (ending value) U1t or U2t in next iteration.
U1t and U2t will be changed U1 and U2
(1st iteration ending value -> 2nd iteration starting value).
S12t=6+2*1i;
S01t=10+5*1i;
U1=110;
U2=110;
R12 = 16.2+24*1i;
U0i=115;
R01= 15.75+31.2*1i;
dx01=106.125;
dx12=81;
U20=10;
zoruu=0.01;
iteration_number = 0;
while true
iteration_number = iteration_number + 1;
fprintf('Starting iteration #%d\n', iteration_number);
dQ12=dx12*U2.^2*10.^-6;
S12i=S12t-complex(0,dQ12);
DS12 =((real(S12i).^2+imag(S12i).^2)/U2.^2)*R12;
S12ii=DS12+S12i;
S12e=S12ii-complex(0,dQ12);
S01i=S12e+S01t;
dQ01=dx01*U1.^2*10.^-6;
S01ii=S01i-complex(0,dQ01);
DS01=((real(S01ii).^2+imag(S01ii).^2)/U1.^2)*R01;
dQ01i=dx01*U0i.^2*10.^-6;
S01ii2=S01ii+DS01;
S01iii=S01ii2-complex(0,dQ01i);
dU01i=(real(S01ii2)*real(R01)+imag(S01ii2)*imag(R01))./U0i;
dU01ii=(real(S01ii2)*imag(R01)-imag(S01ii2)*real(R01))./U0i;
U1t=sqrt((U0i-dU01i).^2+dU01ii.^2);
dU12i=(real(S12ii)*real(R12)+imag(S12ii)*imag(R12))./U1t;
dU12ii=(real(S12ii)*imag(R12)-imag(S12ii)*real(R12))./U1t;
U2t=sqrt((U1t-dU12i).^2+dU12ii.^2);
Y=U1t-U1;
H=U2t-U2;
if max(Y,H)<zoruu;
break;
end;
end
Iteration must end when max(Y,H)<0.01
Thank you
  1 件のコメント
Walter Roberson
Walter Roberson 2013 年 5 月 26 日
Yes, that is what you programmed, that the iterations will end when that condition holds.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2013 年 5 月 26 日
After the assignment to H, assign
U1 = U1t;
U2 = U2t;
Unless, that is, you need the U1 value to be unchanged if the iteration should stop. If that is the case, put those two statements after the "end" for the "if"

その他の回答 (2 件)

Artur M. G. Lourenço
Artur M. G. Lourenço 2013 年 5 月 26 日
Sorry if I misunderstood. It would be just that?
S12t=6+2*1i;
S01t=10+5*1i;
U1=110;
U2=110;
R12 = 16.2+24*1i;
U0i=115;
R01= 15.75+31.2*1i;
dx01=106.125;
dx12=81;
U20=10;
zoruu=0.01;
iteration_number = 0;
while true
iteration_number = iteration_number + 1;
fprintf('Starting iteration #%d\n', iteration_number);
dQ12=dx12*U2.^2*10.^-6;
S12i=S12t-complex(0,dQ12);
DS12 =((real(S12i).^2+imag(S12i).^2)/U2.^2)*R12;
S12ii=DS12+S12i;
S12e=S12ii-complex(0,dQ12);
S01i=S12e+S01t;
dQ01=dx01*U1.^2*10.^-6;
S01ii=S01i-complex(0,dQ01);
DS01=((real(S01ii).^2+imag(S01ii).^2)/U1.^2)*R01;
dQ01i=dx01*U0i.^2*10.^-6;
S01ii2=S01ii+DS01;
S01iii=S01ii2-complex(0,dQ01i);
dU01i=(real(S01ii2)*real(R01)+imag(S01ii2)*imag(R01))./U0i;
dU01ii=(real(S01ii2)*imag(R01)-imag(S01ii2)*real(R01))./U0i;
U1t=sqrt((U0i-dU01i).^2+dU01ii.^2);
dU12i=(real(S12ii)*real(R12)+imag(S12ii)*imag(R12))./U1t;
dU12ii=(real(S12ii)*imag(R12)-imag(S12ii)*real(R12))./U1t;
U2t=sqrt((U1t-dU12i).^2+dU12ii.^2);
Y=U1t-U1;
H=U2t-U2;
U1= U1t;
U2= U2t;
if max(Y,H)<zoruu;
break; end; end
  1 件のコメント
Jan
Jan 2013 年 5 月 26 日
Please learn how for format code - follow the "? Help" link. Thanks.

サインインしてコメントする。


Light
Light 2013 年 5 月 26 日
Thank you very much!! I put it wrong place :-)
  3 件のコメント
Light
Light 2013 年 5 月 27 日
編集済み: Light 2013 年 5 月 27 日
Really? Walter Robinson Please tell me. Where can i put this (U1=U1t, U2=U2t)
Is that right??
....
....
Y=U1t-U1;
H=U2t-U2;
if max(Y,H)<zoruu; break; end;
U1= U1t;
U2= U2t; end
Artur M. G. Lourenço
Artur M. G. Lourenço 2013 年 5 月 27 日
Y=U1t-U1;
H=U2t-U2;
U1= U1t;
U2= U2t;
if max(Y,H)<zoruu;
break; end; end

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by