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

1 回表示 (過去 30 日間)
Hans Wagener
Hans Wagener 2022 年 12 月 14 日
編集済み: KSSV 2022 年 12 月 14 日
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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by