MATLAB Answers

No data points appear on the graph when I hit run

4 ビュー (過去 30 日間)
Aidan Palermo
Aidan Palermo 2021 年 9 月 13 日
編集済み: DGM 2021 年 9 月 13 日
figure (1) %selects plotting window #1
plot(0, 98, 'c--', .02, 245, 'c--', .04, 490, 'c--', .05, 735, 'c--', .06, 931, 'c--', .08, 931, 'c--', .10, 980, 'c--');
I tried adding brackets like this ( [x,y,s,] ) and the graph itself dissapered

回答 (1 件)

DGM
DGM 2021 年 9 月 13 日
編集済み: DGM 2021 年 9 月 13 日
When you plot points one at a time, they are rendered as single unconnected points. Since there is no specified marker type, they don't show up.
You could specify a marker type (i'm using blue so it shows up better against white on the web-view)
plot(0, 98, 'bx', .02, 245, 'bx', .04, 490, 'bx', .05, 735, 'bx', .06, 931, 'bx', .08, 931, 'bx', .10, 980, 'bx');
or you could plot the points as a series
clc
x = [0 0.02 0.04 0.05 0.06 0.08 0.10];
y = [98 245 490 735 931 931 980];
plot(x,y,'b--')

Community Treasure Hunt

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

Start Hunting!

Translated by