When I plot, I only get 5 red dots and a blank graph.
Show older comments
if true
}
clc
clear all
L = 5;
D = 3;
d = 1;
t = 0.1;
w = 500;
x = linspace(0, 1, L);
di = (x./L) * ( d - D) + D;
do = D + d - di;
VR = do / di;
plot(x , VR , 'b');
}
end
i'm new to Matlab, but the graphing procedure sounds really convoluted. I want for 'x' to be my horizontal axis and for VR to be my vertical axis. The graph should look something like a trapezoid if I did my math correct but I can't tell because it won't print the graph. I used '(x./L)' because I read that that makes it a vector, but it didn't change anything with or without it.
Answers (2)
Roger Stafford
on 3 Apr 2016
You should make two changes:
x = linspace(0, 1, w); (or just linspace(0,1) and get the default hundred points)
VR = do ./ di; (You left out the dot)
jeremy morgan
on 3 Apr 2016
0 votes
1 Comment
Image Analyst
on 3 Apr 2016
Jeremy, you should have put this as a comment to Roger, rather than as a new Answer to your original question. Also, please vote for his answer and "Accept" it so he gets reputation points for it.
Categories
Find more on Graphics Performance 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!