I am not getting graphs for my matlab program. Can anyone help?

3 views (last 30 days)
I'm attaching my .m file. The graph should be drawn between L on x-axis and IL on y-axis, for L in between 0 and 100nH with a step size of 1nH. But, when i execute it, i am getting a blank graph. Please suggest any errors in my code.
  2 Comments
Star Strider
Star Strider on 1 Mar 2014
I can’t get your code to run, and until I can experiment with it, I can’t determine what is wrong with it.
The first problem is that drange is undefined.
Second, you’re running the plot in the for loop.
Third, you’re only asking it to plot one point (il) in each iteration of the loop.
Fourth, statements such as:
f=(2*10^9)
are not good programming practice. Use:
f=2E9; or f=2e9;
instead. You do that in a few other places as well.
Also, please describe what you are doing (why you wrote it) and you want it to do. We can never guess what you are thinking!
Jhareesh
Jhareesh on 1 Mar 2014
the 'il' means INSERTION LOSS. Due to the lowercase letters, it appears to be ' i1', but it is "il"(short form of insertion loss). btw, my problem is solved. I just added 'hold all' command as suggested by one user. And it worked... Thank you.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 1 Mar 2014
It appears to me that your
plot(il);
is plotting individual points at height i1, each time at the same x = 1 location. When you plot(Y) then the x coordinates are assumed to be 1 : size(Y,1) (unless Y is row vector), and since your i1 is a single point the implication is that x will always be 1.
And each pass through, your plot() is triggering the erasure of the previous plot.
At the very least, add
hold on;
after the plot() call.
Are you sure you don't want to save all the i1 values and plot them at once afterwards? Such as by assigning to i1(p) inside the loop?
  1 Comment
Jhareesh
Jhareesh on 1 Mar 2014
It is not 'i one' that i wrote. It is "IL", the short form for 'insertion loss'. And, i added 'hold all' command in the loop, and it worked. Thank you.

Sign in to comment.

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!