How do i get the CDF and ICDF functions to accept a variable instead of just numbers.

Not sure what exactly is going on, when i plug in actual number for an upper and lower boundries into the icdf function it works fine but if i use variables with the exact same values it doesn't work, i get an empty matrix.
cdf_upper_bound = .10;
cdf_lower_bound = .20;
z = icdf(D_obj.n , [.10:0.01:.20])'
Unable to resolve the name D_obj.n.

Answers (1)

K>> load D_obj
K>> fieldnames(D_obj)
ans =
3×1 cell array
{'k'}
{'n'}
{'w'}
K>>
The field name is lowercase "k", not uppercase "K". MATLAB is case-sensitive.

5 Comments

Thats not it, maybe i misstyped it here but the code actually computes it just doesnt generate the same result.
The same result as what?
You're going to have to give a minimum working example that illustrates the problem you think you have.
The contents of D_obj are three different distribution functions; what are you comparing to what?
Here is a screencap, I wound think z and k would output the same values since all the arguments/range are equal but as you can thats not the case here.
Apologies if i was vague.
Opps, just realized i crossed my variable. that was the issue. thanks for taking a look though.
I was pretty sure had to be something of the sort...glad you found it.

Sign in to comment.

Products

Release

R2021b

Asked:

on 2 Dec 2021

Commented:

dpb
on 3 Dec 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!