필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Area not filled with curve crossing zeros several time, any ideas ?

조회 수: 1 (최근 30일)
Maxime Yon
Maxime Yon 2017년 5월 16일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello,
I want to filled the area between the zero and a curve.
I use area and it works for a gausien function but not for cardinal sinus.
here is the code :
w1=-100:0.01:100;
%%Gaussienne
w0=10;
wg = 10;
Ig = (1./(wg*sqrt(pi)))*exp(-((w1-w0)./(wg)).^2);
area(w1,Ig,'FaceColor',[1 0.6 0.6],'EdgeColor',[1 0 0],'LineWidth',5)
%%Cardinal sinus
w0= 0;
Sig = 0.25;
sc = sin((w1-w0)*Sig)./((w1-w0)*Sig);
area(w1,sc,'FaceColor',[1 0.6 0.6],'EdgeColor',[1 0 0],'LineWidth',5)
Any ideas ?
thank you
  댓글 수: 1
Maxime Yon
Maxime Yon 2017년 5월 16일
It works with a slightly different period of function
I just multipliy w0 by 1.1 and it works
This will stay a mystery for me...

답변 (1개)

Star Strider
Star Strider 2017년 5월 16일
Use the hold function.
See if this does what you want:
w1=-100:0.01:100;
% %%Gaussienne
w0=10;
wg = 10;
Ig = (1./(wg*sqrt(pi)))*exp(-((w1-w0)./(wg)).^2);
figure(1)
area(w1,Ig,'FaceColor',[1 0.6 0.6],'EdgeColor',[1 0 0],'LineWidth',5)
% %%Cardinal sinus
w0= 0;
Sig = 0.25;
sc = sin((w1-w0)*Sig)./((w1-w0)*Sig);
hold on
area(w1,sc,'FaceColor',[1 0.6 0.6],'EdgeColor',[1 0 0],'LineWidth',5)
hold off
  댓글 수: 2
Maxime Yon
Maxime Yon 2017년 5월 16일
Thank you but this do not change my problem :
I do not want the two graphs to be on the same windows.
I want the second on to be filled which is not the case.
Star Strider
Star Strider 2017년 5월 16일
I am lost.
Please explain in more detail what you want.

이 질문은 마감되었습니다.

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by