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

14 visualizzazioni (ultimi 30 giorni)
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')

Risposte (1)

Image Analyst
Image Analyst il 4 Feb 2022
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 Commenti
Md. Golam Zakaria
Md. Golam Zakaria il 4 Feb 2022
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 il 4 Feb 2022
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:

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by