I am a matlab beginner and can not spot the mistake in the following code:
a=0.5; b=0.5; f=@(u,x) exp(-x.^2/2)*(2*pi).^(-1/2)*exp(log(a+b.*x.^2).*u); t=0:0.1:1; g=0*t; for i=1:numel(t) fab=@(x) f(t(i),x); g(i)=quadgk(fab,-inf,inf); end surf(t,g)
Where is the format wrong? I really do not get it. I want to plot the value of a integral in dependence of a parameter.
Thank you!
Two things. First, add some more
., if you usefworks as it should. Second,surfdoes not work for 1d-plots, useplot, giving