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

2 次查看(过去 30 天)
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

采纳的回答

KSSV
KSSV 2022-12-14
编辑:KSSV 2022-12-14
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by