Please help with plotting and for loops!
이전 댓글 표시
Hi,
I'm new to Matlab so, I'm trying my best! Thank you in advance for the help.
This is my code:
frequency0 = 10e9;
lambda0 = 3e8 / frequency0;
l = 0.5 * lambda0;
l = l * 39.3701;
n = 10;
delta = l/n;
Z1 = 50;
Z2 = 100;
for x = [0:delta:l]
Z0 = Z1 + (Z2 - Z1)*(x/l);
Zin_linear = Z0 * (((Z2 * cos(B* x)) + (j * Z0 * sin(B * x))) / ((Z0 * cos(B*x)) + (j * Z2 * sin(B*x))));
Z2 = Zin_linear;
endfor
plot(x,Z0);
What I'm trying to do, is for each number in x, I want to calculate the Z0 and the Zin_linear. Then I want to take Z2 and replace it with Zin_linear and then calculate a new Z0 and I want to do this until we reach l. However, when I plot this, I get one point on the graph. What am I doing wrong?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!