How do I plot a 3D surface plot from two for loops
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponse acceptée
KSSV
le 14 Déc 2022
Modifié(e) : KSSV
le 14 Déc 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);
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
