Borrar filtros
Borrar filtros

how to use for loop with vectos?

2 visualizaciones (últimos 30 días)
Md. Golam Zakaria
Md. Golam Zakaria el 5 de Feb. de 2022
Comentada: Md. Golam Zakaria el 6 de Feb. de 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 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 6 de Feb. de 2022
Still improvement & changes required in the code?
Md. Golam Zakaria
Md. Golam Zakaria el 6 de Feb. de 2022
nope

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by