필터 지우기
필터 지우기

how to use for loop with vectos?

조회 수: 2 (최근 30일)
Md. Golam Zakaria
Md. Golam Zakaria 2022년 2월 5일
댓글: Md. Golam Zakaria 2022년 2월 6일
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?
Md. Golam Zakaria
Md. Golam Zakaria 2022년 2월 6일
nope

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by