How to plot in three y axis with one x axis?

조회 수: 4 (최근 30일)
Md. Golam Zakaria
Md. Golam Zakaria 2022년 2월 4일
댓글: Image Analyst 2022년 2월 4일
Hello everyone. I have three different figure . All of them are on same x axis. I want to plot all three figures in same graph. That means three y axis but one common x axis. I know about two y axis; but do not know how to plot against three. Can anyone please help me.
clc
clear all
close all
%parametrs
Fs= 2.16*10^-5*pi; % Geometrical Factor for sun
Fa=pi; % Geometrical Factor for earth
q=1.6*10^-16; % Electronic Charge
h= 6.626*10^-34; % Plancks Constant
c= 3*10^8; % Speed of light
K = 8.61*10^-5; % Boltzmanns Constant
Ts=5760; % Temparature of the sun
Ta=300; % Ambient Temparature
Eg=1.6; % BandGap Energy
A=((2*Fs)/((h^3)*(c^2)));
B=((2*Fa)/((h^3)*(c^2)));
%Short Circuit Current
Absorbrd_Flux=@(E) ((q*A).*(E.^2./(exp((E./(K.*Ts))-1))));
Jsc=integral(Absorbrd_Flux,Eg,inf);
%Dark Current
vdata=0:0.001:1.6;
n=length(vdata);
Jdark=zeros(1,n);
for i=1:n
V=vdata(i);
Jd=@(E) ((q*B).*((E.^2./(exp((E-V)./K*Ta)-1))-(E.^2./(exp(E./K*Ta)-1))));
Jdark(i)=integral(Jd,Eg,inf);
end
%J-V Characteristic
Jv=(Jsc-Jdark);
%P-V Characteristic
Pv=vdata.*Jv;
%Power Input
Irradiance=@(E) ((q*A).*(E.^2./(exp((E./(K.*Ts))-1))));
Pinput=integral(Irradiance,0,inf);
%Efficiency
efficiency=Pv/Pinput;
figure(1)
plot(vdata,efficiency)
xlim([0 1.8])
ylim([0 inf])
xlabel('Voltage (V)'),ylabel('Efficiency')
figure(2)
plot(vdata,Jv)
xlim([0 1.8])
ylim([0 inf])
xlabel('Voltage (V)'),ylabel('Current Density')
figure (3)
plot(vdata,Pv)
xlim([0 1.8])
ylim([0 inf])
xlabel('Voltage (V)'),ylabel('Power Density')

답변 (1개)

Image Analyst
Image Analyst 2022년 2월 4일
You can certainly do two with the yyaxis command. Three I think would be confusing for the viewer to interpret. I think you'd be better off just having 2 or 3 different subplots. Use subplot() or nexttile(). That would be if the ranges are vastly different for the three and can't really all fit onto the same plot if they used a common/automatic y axis scaling.
  댓글 수: 2
Md. Golam Zakaria
Md. Golam Zakaria 2022년 2월 4일
Apparently there is a way of doing what I asked using a user defined function named plotyyy or multiplotyyy. But I am finding this confusing.
Image Analyst
Image Analyst 2022년 2월 4일
Can you mock up something (in Photoshop or wherever) for what you envision your 3 y axis plot looking like? And explain what's wrong with having 2 or 3 separate plots?
Here are some ideas:

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by