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!