Azzera filtri
Azzera filtri

How do I plot a 3D surface plot from two for loops

2 visualizzazioni (ultimi 30 giorni)
Hi all,
I am trying to make a 3D surface plot from the variable 'eta', which is the product from U and F. On the x-axis i, ranging from 0 to 100. On the y-axis SOC, ranging from 0 to 6. The Z axis should give the value for eta for a certain i and SOC
Below you find the code:
clear all
close all
clc
%I-U curve
T = 80;
r1 = 4.45153e-5;
r2 = 6.88874e-9;
r = r1 + (r2*T);
s = 0.33824;
d1 = -3.12996e-6;
d2 = 4.47137e-7;
p = 30;
t1 = -0.01539;
t2 = 2.00181/T;
t3 = 15.24178/T^2;
t = t1 + t2 + t3;
U_rev = 1.229;
k =1;
for i = 0:1:100
U(k) = 1.71*1.025*(1.48/(U_rev + ((r1+d1)+(r2*T)+(d2*p))*(i*50) + (s * log((t*(i*50))+1))));
k = k+1;
end
j = 1;
for SOC = 0:0.06:6
F(j) = 1-((4*exp(-2*SOC))/(1+exp(-2*SOC))^2);
j = j+1;
end
eta = U.*F;
surf(i,SOC,eta); hold on

Risposta accettata

KSSV
KSSV il 14 Dic 2022
Modificato: KSSV il 14 Dic 2022
clear all
close all
clc
%I-U curve
T = 80;
r1 = 4.45153e-5;
r2 = 6.88874e-9;
r = r1 + (r2*T);
s = 0.33824;
d1 = -3.12996e-6;
d2 = 4.47137e-7;
p = 30;
t1 = -0.01539;
t2 = 2.00181/T;
t3 = 15.24178/T^2;
t = t1 + t2 + t3;
U_rev = 1.229;
i = 0:1:100 ;
U = 1.71*1.025*(1.48./(U_rev + ((r1+d1)+(r2*T)+(d2*p))*(i*50) + (s * log((t*(i*50))+1))));
SOC = 0:0.06:6 ;
F = 1-((4*exp(-2*SOC))./(1+exp(-2*SOC)).^2);
eta = U'*F;
surf(i,SOC,eta);

Più risposte (0)

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by