Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
quadgk as function handle

Subject: quadgk as function handle

From: Dhrue

Date: 29 Jul, 2009 06:35:04

Message: 1 of 2

My objective is to derive the distribution of z2 when I know the distribution of z is lognormal (4,1.3).

zh= logninv(.999,4,1.3); %upper bound
density=@(z) lognpdf(z,4,1.3);
mass=quadgk(density,100,zh);
firm_1_pdf=@(z) density(z)./mass %a new distribution derived form lognormal
Now I want to know pdf of z2 given "firm_1_pdf" above
z2=@(z) z.^.4 %
Fy=@(z) quadgk(firm_1_pdf(z),z2(100),z2(zh)
hh=@(z) gradient(Fy(z))
THis does not work. It seems quadgk cannot be used in this way.....Please can you suggest another method!!
Thanks
Dhrue

Subject: quadgk as function handle

From: Michael Hosea

Date: 29 Jul, 2009 08:39:06

Message: 2 of 2

It doesn't have anything to do with QUADGK. You need to sort out which
variables are the independent variables in the call. The first argument of
QUADGK is a function handle for a function of one independent variable. If
you define

Fy = @(z)quadgk(firm_1_pdf(z),...)

Then the first input argument to QUADGK is not a function handle. Normally,
I would expect to see something like

Fy = @(z)quadgk(@(t)foo(t,z), ...)

if z is a parameter of the integrand or

Fy = @(z)quadgk(@foo,a,z,...)

if z is a limit of integration. In no case would I ever expect to see

Fy = @(z)quadgk(foo(z),...)

--
Mike

"Dhrue " <dhritiman-bhattacharya@uiowa.edu> wrote in message
news:h4oqio$8td$1@fred.mathworks.com...
> My objective is to derive the distribution of z2 when I know the
> distribution of z is lognormal (4,1.3).
>
> zh= logninv(.999,4,1.3); %upper bound
> density=@(z) lognpdf(z,4,1.3);
> mass=quadgk(density,100,zh);
> firm_1_pdf=@(z) density(z)./mass %a new distribution derived form
> lognormal
> Now I want to know pdf of z2 given "firm_1_pdf" above
> z2=@(z) z.^.4 %
> Fy=@(z) quadgk(firm_1_pdf(z),z2(100),z2(zh)
> hh=@(z) gradient(Fy(z))
> THis does not work. It seems quadgk cannot be used in this way.....Please
> can you suggest another method!!
> Thanks
> Dhrue

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us