Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University 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 ]
Steven Lord

Posts: 17,945
Registered: 12/7/04
Re: Handle function implicitly accounting for independent variables
Posted: Jan 7, 2013 9:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Francesco Perrone" <francesco86perrone@yahoo.it> wrote in message
> I have that


> E = @(k) (1.453*k.^4)./((1 + k.^2).^(17/6));


> Afterwards, I compute F_33 as
> for i = 1:numel(k1) count = count + 1; phi_33 = @(k2,k3)
> (1.453./(4.*pi)).*(((k1(i)^2+k2.^2+(k3 +
> beta(i).*k1(i)).^2).^2)./((k1(i)^2+k2.^2+k3.^2).^2)).*((k1(i)^2+k2.^2)./((1+k1(i)^2+k2.^2+(k3+beta(i).*k1(i)).^2).^(17/6)));
> F_33(count) = 4*integral2(phi_33,0,1000,0,1000); end
> Now let's come to my question. I know from a paper that:
> k = sqrt(k1.^2+k2.^2+k3.^2);
> k30 = k3 + beta.*k1;
> k0 = sqrt(k1.^2+k2.^2+k30.^2);
> E_k0 = 1.453.*(k0.^4./((1+k0.^2).^(17/6)));
> Therefore the expression for phi_33 would result in
> phi_33 = (E_k0./(4*pi.*(k.^4))).*(k1.^2+k2.^2);
> The question is: how can I make use of this final expression insted of the
> long one I'm using at the moment (within the for loop)?

You have a function for E that you can use to generate E_k0. Change your
expressions for k, k30, and k0 into functions then call those functions in
your phi_33 function.

k = @(k2, k3) sqrt(k1.^2+k2.^2+k3.^2);
k30 = @(k2, k3) k3 + beta.*k1;
k0 = @(k2, k3) sqrt(k1.^2+k2.^2+k30.^2);
phi_33 = @(k2, k3) (E(k0(k2, k3))./(4*pi.*(k(k2, k3).^4))).*(k1.^2+k2.^2);

Note that saying E(k0) would NOT be sufficient; E doesn't operate on a
function handle but on a numeric value, and so you need to evaluate the k0
function and pass the result it returns into the E function.

k1 also needs to be defined before you define ANY of these functions; the
function handles will "remember" the value of k1 that existed when they were

Steve Lord
To contact Technical Support use the Contact Us link on

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

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.