Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Handle function implicitly accounting for independent variables

$
0
0
Dear Steven Lord,

I changed my approach a little bit.

At the moment I'm doing like this:
1. First I wrote a standard function phi_33_kai

function phi_33 = phi_33_kai(k1,k2,k3,beta,i)
k = sqrt(k1(i).^2 + k2.^2 + k3.^2);
k30 = k3 + k1(i).*beta(i);
k0 = sqrt(k1(i).^2 + k2.^2 + k30.^2);
E_k0 = 1.453.*(k0.^4./((1 + k0.^2).^(17/6)));
phi_33 = E_k0./(4.*pi.*k.^4).*(k1(i).^2 + k2.^2);
end

2. Then, I call that in the previous for loop as follows:

clc,clear all,close all
k1 = (1E-02:0.1:100);
load beta.mat %% the procedure to calculate beta is not reported anymore (see first msg)

F_33 = zeros(1,numel(k1));
count = 0;
for i = 1:numel(k1)
    count = count + 1;
    phi_33 = @(k2,k3) phi_33_kai(k1,k2,k3,beta,i);
    F_33(count) = quad2d(phi_33,-100,100,-100,100);
end

Is this way comparable to yours or it has any relevant flaw?

Btw, would you mind to extend your approach with a whole piece of code: I was not able to completely understand it. I thank you in advance.

Kindest regards,
Francesco Perrone

Viewing all articles
Browse latest Browse all 19628

Trending Articles