need syntax to store and preallocate the output from a for loop and use them for serial multiplication

Please how can i implement this for loop to get the serial multiplication
f = 25 ;
m = 0:10:80;
Zcb = 104.5;
l = 3.75e-3 ;
Zo = (1 + (0.055*(1-1i))/sqrt(f));
n = 800 ;
x = 1;
P = 800;
Z1 = 1+((m)*sin(2*pi*n*x/P));
ZB = abs(Zcb*Zo*Z1);
u = ((494)+(36/f))*1.0e-9;
Vpk = 100/u ;
Attk = (1.80*sqrt(f)+ 0.005*(f)+ 0.25/sqrt(f));
Qk = ((Attk)*(0.01))/(8.68588963807);
Bk = (2*pi*f*1.0e6)/(Vpk);
Yk =(Qk + 1i*Bk);
H = (1.0000 + 0.0000i);
N = (0.0000 + 0.0029i);
Ds = (2*ZB.*Zo*H) + ((ZB.^2+Zo^2)*N);
SB11 = ((ZB.^2-Zo^2)*N)/Ds;
SB12 = (2*ZB.*Zo)/Ds;
SB21 = (2*ZB.*Zo)/Ds;
SB22 = ((ZB.^2-Zo^2)*N)/Ds;
% Program to convert S matrix to T matrix
TB11 = ((SB12*SB21)-(SB11*SB22))/SB21;
TB12 = (SB11/SB21);
TB21 = -(SB22/SB21);
TB22 = (1/SB21);
TB = [TB11 TB12;TB21 TB22];
% program to get the sequential product of TB from the for loop above
T = TB1*TB2*TB3*TB4*TB5*TB6*TB7*TB8*TB9*TB10;

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 9월 15일
편집: Andrei Bobrov 2013년 9월 15일
Zo = 100;
H = (1.0000 + 0.0000i);
N = (0.0000 + 0.0029i);
Ds = (2.1132e+004 +6.1764e+001i);
ZB = reshape(1:2:20,1,1,[]);
Ds = 2*ZB.*Zo*H + (ZB.^2+Zo^2)*N;
SB11 = (ZB.^2-Zo^2)*N./Ds;
SB12 = (2*ZB.*Zo)./Ds;
TB11 = (SB12.^2-SB11.^2)./SB12;
TB12 = SB11./SB12;
TB22 = 1./SB12;
out = prod([TB11 TB12;-TB12 TB22],3);

댓글 수: 1

Thanks for your help. I need the answer to the complete program as now amended above without removing anything.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by