Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Handle function implicitly accounting for independent variables
Replies: 2   Last Post: Jan 7, 2013 2:08 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Francesco Perrone

Posts: 39
Registered: 5/2/12
Re: Handle function implicitly accounting for independent variables
Posted: Jan 7, 2013 2:08 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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);

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);

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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2016. All Rights Reserved.