MATLAB Answers

How to graph multiple points onto one graph?

186 views (last 30 days)
Brian Len
Brian Len on 19 May 2020
Edited: Robert U on 19 May 2020
I am trying to make these multiple points onto one graph, but when I try, it does not show it. Here are the points. any help?
(0,3.8*10^8)
(1,4.2*10^7)
(2,1.5*10^7)
(3,7.8*10^7)
(4,4.7*10^6)
(5,3.16*10^6)
(6,2.3*10^6)
(7,1.7*10^6)
(8,1.3*10^6)
(9,1.05*10^6)
(10,8.66*10^5)

Accepted Answer

Robert U
Robert U on 19 May 2020
Edited: Robert U on 19 May 2020
Hi Brian Len,
you might have some troubles with syntax. Have a look at the very good documentation: https://de.mathworks.com/help/matlab/language-fundamentals.html
dInput = [0,3.8e8;
1,4.2e7;
2,1.5e7;
3,7.8e7;
4,4.7e6;
5,3.16e6;
6,2.3e6;
7,1.7e6;
8,1.3e6;
9,1.05e6;
10,8.66e5];
fh = figure;
ah = axes(fh);
hold(ah,'on');
plot(ah,dInput(:,1),dInput(:,2),'.')
Kind regards,
Robert

More Answers (1)

KSSV
KSSV on 19 May 2020
data = [0,3.8*10^8
1,4.2*10^7
2,1.5*10^7
3,7.8*10^7
4,4.7*10^6
5,3.16*10^6
6,2.3*10^6
7,1.7*10^6
8,1.3*10^6
9,1.05*10^6
10,8.66*10^5] ;
x = data(:,1) ;
y = data(:,2) ;
figure
hold on
plot(x,y,'*r')
plot(x,y,'b')
legend('Markers plot','lineplot') ;

Tags

Community Treasure Hunt

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

Start Hunting!