how to use for loop with vectos?

4 次查看(过去 30 天)
Hello everyone. I have a simple problem (huge for me). I need to use a for loop for generating several graphs. The code will explain better--
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^-19; % Electronic Charge
h= 4.136*10^-15; % 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)));
%Power Input
Irradiance=@(E) ((q*A).*(E.^3./(exp((E./(K.*Ts))-1))));
Pin=integral(Irradiance,0,inf) %gives a constant value
%Short Circuit Current
Absorbrd_Flux=@(E) ((q*A).*(E.^2./(exp((E./(K.*Ts))-1))));
Jsc=integral(Absorbrd_Flux,Eg,inf) %gives a constant value
V=1.3 %vary this value from 0:0.1:Eg i.e 0:0.1:1.6
Jd=@(E) ((q*B).*((E.^2./(exp((E-V)./(K*Ta))-1))-(E.^2./(exp(E./(K*Ta))-1))));
Jdark=integral(Jd,Eg,inf)
Jout=Jsc-Jdark
Pv=V*Jout
efficiency=Pv/Pin
%Plot Jout vs V
%Plot Pv vs V
%Plot efficiency vs V
I have checked the code manually and it works. I need to vary the value of V from 0 to 1.6 or 0 to Eg. For each value of V, need to calculate Jout, Pv, efficiency. At last, I need several xy graphs which will plot the value of V at x axis and the value of the determined variables at y axis. so actually three figures as I mentioned as comment in the code.
Someone please help me .
  4 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2022-2-6
Still improvement & changes required in the code?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by