필터 지우기
필터 지우기

How to plot this function?

조회 수: 1 (최근 30일)
Michaël
Michaël 2011년 3월 14일
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

채택된 답변

Matt Fig
Matt Fig 2011년 3월 15일
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}')

추가 답변 (4개)

Matt Tearle
Matt Tearle 2011년 3월 14일
Take a look at erfc. A simple change of coordinates should get you there.
Then plotting can be done by
x = linspace(xmin,xmax,npoints);
y = constant*erfc(x);
plot(x,y)
  댓글 수: 2
Michaël
Michaël 2011년 3월 14일
Thank you for your answer.
But can't I put my function directly (without going through a pre-determined function)?
Thanks
Matt Tearle
Matt Tearle 2011년 3월 15일
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.

댓글을 달려면 로그인하십시오.


Michaël
Michaël 2011년 3월 14일
Thank you for your answer.
But can't I put my function directly (without going through a pre-determined function)?
Thanks

Michaël
Michaël 2011년 3월 14일
How can't we put : (-1+x.)^2 ?

Michaël
Michaël 2011년 3월 15일
Thank you very much !!!

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by