Filter löschen
Filter löschen

how to use for loop with vectos?

2 Ansichten (letzte 30 Tage)
Md. Golam Zakaria
Md. Golam Zakaria am 5 Feb. 2022
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 Kommentare
KALYAN ACHARJYA
KALYAN ACHARJYA am 6 Feb. 2022
Still improvement & changes required in the code?
Md. Golam Zakaria
Md. Golam Zakaria am 6 Feb. 2022
nope

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by