MATLAB Answers

Getting an empty plot

39 views (last 30 days)
sid101
sid101 on 11 Nov 2019
Commented: sid101 on 11 Nov 2019
Hi, I have a variable x that varies from 5.62 to 31.62 and then a formula to calculate p as a function of x. When I try to plot x versus p, I get no errors but an empty plot
I would appreciate if someone can point me in the right direction. Below is the code:
clear;
x = linspace(5.62,31.62);
p = -10*log10((1+ (31.5844 * (x.^2)) + (11.24*x*cos(pi)))/ (32.5844*(1 + (x.^2))));
figure
plot(pl,x)
Thanks

  0 Comments

Sign in to comment.

Accepted Answer

Shubham Gupta
Shubham Gupta on 11 Nov 2019
Try:
clear;
x = linspace(5.62,31.62);
p = -10*log10((1+ (31.5844 * (x.^2)) + (11.24*x*cos(pi)))./ (32.5844*(1 + (x.^2)))); % "./" instead of "/"
figure
plot(p,x) % p instead of pl

  1 Comment

sid101
sid101 on 11 Nov 2019
Thank you. This works

Sign in to comment.

More Answers (0)

Tags


Translated by