MATLAB Answers

2D plot with 3 axis and 3 column data

3 views (last 30 days)
I have 3 column data. I plot 2D 3 axis graph in Excel. I want the same also with colours and labels on Matlab. It is attached as graph name. Can you help me please?

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 14 Feb 2020
I have no idea which column is which curve.
Try this:
[D,T,R] = xlsread('Kitap3.xlsx');
Q1 = D(1:15,:);
time = linspace(0, size(D,1), size(D,1));
figure
yyaxis left
plot(time, D(:,1))
hold on
plot(time, D(:,2))
yyaxis right
plot(time, D(:,3))
hold off
Experiment with the column assignments to get the result you want.
See the documentation on yyaxis for details.

  6 Comments

Show 3 older comments
Star Strider
Star Strider on 18 Feb 2020
As always, my pleasure.
Try this:
figure
yyaxis left
plot(time, D(:,1))
hold on
plot(time, D(:,2))
hold off
ylabel('Left y-Axis')
yyaxis right
plot(time, D(:,3))
ylabel('Right y-Axis')
xlabel('Time')
This labels both of them, and the x-axis. Delete the ones you do not need.

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by