Use $integral $ and $fzero$ with ksdensity
1 回表示 (過去 30 日間)
古いコメントを表示
Hello, I have been looking for finding the intersection of two outputs of ksdensity, as well as integrating the difference of the two questions. Can you please see the code, you might understand what I am trying to say:
xlsread('Sheet1.xlsx','Hourly Data','B:B'); % load Data
Load = xlsread('Sheet1.xlsx','Hourly Data','D:D'); %load Data
[f_re,xr] = ksdensity(RE); % to return the 1st pdf
[f_lo,xl] = ksdensity(Load); %returns the 2nd pdf
figure
plot(xl,f_lo,xr,f_re); % plot
f1=@(x) f_re(x); % and starting from this line , things are getting complicated
f2=@(x) f_lo(x);
Pl=fzero(f1-f2,0); % trying to find the intersections of the two functions may be
q = integral(f1-f2,0,inf); % integrating the difference ?
And obviously, Matlab does return errors. I do not know how to do all of this, Could you please give me some hints! Thank you so much.
0 件のコメント
採用された回答
Walter Roberson
2016 年 9 月 29 日
Pl=fzero(@(x) f1(x)-f2(x),0); % trying to find the intersections of the two functions may be
q = integral(@(x) f1(x)-f2(x),0,inf); % integrating the difference ?
You cannot add or subtract function handles: you have to call the function handles with arguments and add or subtract the results.
2 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!