I want to obtain value of "W" for different combination of values of (psi,r) example. "W" for (psi=0.0001,r = 2.1891) ; (psi=0.001,r = 2.1940); (psi=0.01,r = 2.2373) and so on
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
AVINASH SAHU
le 22 Juin 2022
Commenté : AVINASH SAHU
le 22 Juin 2022
psi = 0.001;
alpha = (12*psi)^(1/3);
r = 2.1940;
l1 = (r + alpha)*(r + alpha);
l1a = r*r - r*alpha + alpha*alpha;
L1 = log(l1/l1a);
t1 = (2*r - alpha) / (alpha*sqrt(3));
T1 = atan(t1);
l2 = (1 + alpha)*(1 + alpha);
l2a = (1*1) - (1*alpha) + (alpha*alpha);
L2 = log(l2/l2a);
t2 = (2*1 - alpha) / (alpha*sqrt(3));
T2 = atan(t2);
W1 = 4 * sqrt(3) * (T1 - T2) * log((r+alpha)/(1+alpha));
W2 = (L1 - L2)*log((r*r - r*alpha + alpha*alpha)/(1 - alpha + alpha*alpha));
W3 = 4*(T1 -T2)*(T1 -T2);
W4 = (L1 - L2) + 2 * sqrt(3) * (T1 - T2);
W5 = 3 ./ ((r - 1) * (r - 1));
W = ((W1 + W2 -W3) * W5)/W4
2 commentaires
Dyuman Joshi
le 22 Juin 2022
Modifié(e) : Dyuman Joshi
le 22 Juin 2022
Make it a function and call from workspace.
%calling individually
W1=calculateW(0.0001,2.1891)
W2=calculateW(0.001,2.194)
W3=calculateW(0.01,2.2373)
function W = calculateW(psi,r)
alpha = (12*psi)^(1/3);
l1 = (r + alpha)*(r + alpha);
l1a = r*r - r*alpha + alpha*alpha;
L1 = log(l1/l1a);
t1 = (2*r - alpha) / (alpha*sqrt(3));
T1 = atan(t1);
l2 = (1 + alpha)*(1 + alpha);
l2a = (1*1) - (1*alpha) + (alpha*alpha);
L2 = log(l2/l2a);
t2 = (2*1 - alpha) / (alpha*sqrt(3));
T2 = atan(t2);
W1 = 4 * sqrt(3) * (T1 - T2) * log((r+alpha)/(1+alpha));
W2 = (L1 - L2)*log((r*r - r*alpha + alpha*alpha)/(1 - alpha + alpha*alpha));
W3 = 4*(T1 -T2)*(T1 -T2);
W4 = (L1 - L2) + 2 * sqrt(3) * (T1 - T2);
W5 = 3 ./ ((r - 1) * (r - 1));
W = ((W1 + W2 -W3) * W5)/W4;
end
Réponse acceptée
Dyuman Joshi
le 22 Juin 2022
%loop
psi=[0.0001,0.001,0.01];
r=[2.1891,2.194,2.2373];
for i=1:numel(psi)
W(i)=calculateW(psi(i),r(i));
end
W
%arrayfun
W1=arrayfun(@calculateW, psi, r)
function W = calculateW(psi,r)
alpha = (12*psi)^(1/3);
l1 = (r + alpha)*(r + alpha);
l1a = r*r - r*alpha + alpha*alpha;
L1 = log(l1/l1a);
t1 = (2*r - alpha) / (alpha*sqrt(3));
T1 = atan(t1);
l2 = (1 + alpha)*(1 + alpha);
l2a = (1*1) - (1*alpha) + (alpha*alpha);
L2 = log(l2/l2a);
t2 = (2*1 - alpha) / (alpha*sqrt(3));
T2 = atan(t2);
W1 = 4 * sqrt(3) * (T1 - T2) * log((r+alpha)/(1+alpha));
W2 = (L1 - L2)*log((r*r - r*alpha + alpha*alpha)/(1 - alpha + alpha*alpha));
W3 = 4*(T1 -T2)*(T1 -T2);
W4 = (L1 - L2) + 2 * sqrt(3) * (T1 - T2);
W5 = 3 ./ ((r - 1) * (r - 1));
W = ((W1 + W2 -W3) * W5)/W4;
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Lighting, Transparency, and Shading 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!