How to plot this function?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
Could you please help me plot this function with Matlab ?
<http://img638.imageshack.us/img638/3205/fonction.png >
I'm a beginner. Your help will be valuable to me.
Many thanks
0 Kommentare
Akzeptierte Antwort
Matt Fig
am 15 Mär. 2011
If you want to do it manually, try this:
f = @(z) quadv(@(x) (1/(3*sqrt(2*pi)))*exp(-(x-30).^2/18),z,100);
Z = 0:.25:50;
G = zeros(1,length(Z));
for ii = 1:length(Z)
G(ii) = f(Z(ii));
end
plot(Z,G)
xlabel('z')
ylabel('(1/\surd(2*pi))\inte^{-(x-30)^2/18}')
0 Kommentare
Weitere Antworten (4)
Matt Tearle
am 14 Mär. 2011
Then plotting can be done by
x = linspace(xmin,xmax,npoints);
y = constant*erfc(x);
plot(x,y)
2 Kommentare
Matt Tearle
am 15 Mär. 2011
Why would you want to? This function is defined via an improper integral, which means you'll have to do an infinite-domain integral for each value of z. This will be slow and will introduce all sorts of numerical errors. On the other hand, the error function is a well-known function -- its implementation in MATLAB is stable and tested. Why reinvent the wheel?
But if you really want to, you can use something like quad to do the integral.
Siehe auch
Kategorien
Mehr zu Multirate Signal Processing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!