필터 지우기
필터 지우기

how to add multiple y-axis point on my plot?

조회 수: 1 (최근 30일)
Fadi Ghanim
Fadi Ghanim 2017년 2월 8일
답변: John Chilleri 2017년 2월 8일
so what i want to do is generate a lot that has two y-axis data the following is my code and I want to add y' on the graph. I have already entered the data, but i'm having trouble having it displayed.
%AE 341 Plot for flat plate and expereiemntal
%mass flow rate x = [.433; .8679; 1.1068; 1.3852; 1.7846; 2.1664; 2.3853; 2.8252;];
%forceexperimental y = [.3924; .7846; 1.1768; 1.5691; 1.9614; 2.3537; 2.7460; 3.1382;];
y' = [.433; .8679; 1.1068;1.3852;1.7846; 2.1664; 2.3853; 2.8252;];
plot(x(1:end - 1) ,y(1:end - 1),'o'); hold on
plot(x(end),y(end), '-o')
xlim([x(1) x(end)+x(1)]), ylim([y(1) y(end)+y(1)])
grid on
xlabel('Mass Flow Rate')
ylabel('Experiemental Force')
title('Jet Momentum Force vs. Linear Momentum on Flat Plate')
lsline

답변 (1개)

John Chilleri
John Chilleri 2017년 2월 8일
Hello,
To have two different y-axis (on left and right sides), you can use one of two functions depending on which MATLAB release you're running.
With newer versions of MATLAB, you can use:
yyaxis right
% plot and do whatever you want on the right side
yyaxis left
% plot and do whatever you want on the left side
If you are running an older release, you will need to use:
plotyy(X1,Y1,X2,Y2)
which is an older, not-recommended version of yyaxis.
For more information, see the documentation for yyaxis and plotyy.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by