Please help with plotting and for loops!
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!