Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Hans Wagener
Hans Wagener am 14 Dez. 2022
Bearbeitet: KSSV am 14 Dez. 2022
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

Akzeptierte Antwort

KSSV
KSSV am 14 Dez. 2022
Bearbeitet: KSSV am 14 Dez. 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);

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by