How to plot a function with many parameters ?
显示 更早的评论
Hi,
I want to plot a special function :
function file
function f = sigmalos(x,R,S,T,betar,rhalf)
G = 6.67384*10^(-11)*(1.9891/(3.08568025)^3)*10^(-27);
vit = @(d,rhos,rs) d.^(2.*betar-2).*(3./(4.*pi.*rhalf.^3.*(1+(d./rhalf).^2).^(2.5))).*(4*pi.*rhos.*rs.^3.*(-(d./(d+rs))-log(rs)+log(d+rs)));
vit2 = @(e,rhos,rs) (e./sqrt(e.^2-R.^2)).*(1-betar.*(R./e).^2).*G.*e.^(-2.*betar).*integral(@(e)vit(e,rhos,rs),e,Inf);
f =((S-sqrt(((2/(1./(pi.*rhalf.^2.*(1+(R./rhalf).^2).^2)))*integral(@(b)vit2(b,x(1),x(2)),R,inf,'ArrayValued',true))*(3.08568025*10^16)^2))/T)^2
- betar and rhalf are known and always the same
- R,S,T come from data (input)
- x is like [x(1),x(2)] and i used fminsearch to obtain the best value :
options = optimset('PlotFcns',@optimplotfval,'Display','final');
fminsearch(@(x) (sigmalos(x,input(1,1),input(1,3),input(1,4),betar,rhalf)+[...]+sigmalos(x,input(47,1),input(47,3),input(47,4),betar,rhalf)),[100000000,1],options)
First question : do you have a solution to use sum() in the fminsearch function instead of writing "sigmalos()+sigmalos(+...".
Then, I want to plot the result with a confident level of 1 sigma. So I would like to plot "sigmalos()+sigmalos(+..." when the function < a given value.
Second question : how to plot this function with fixed parameters (but still in the input of the function file) and with the x.
Third question : how to plot only when "sigmalos()+sigmalos(+..." < a given value.
Thanks for your help.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!