Problem with command Fill

조회 수: 2 (최근 30일)
Miguel Ángel
Miguel Ángel 2013년 12월 13일
편집: Miguel Ángel 2013년 12월 13일
Hi
I have problem when using fill. I suppose it may be related with floating. If I reduce values of timescale I get the desired result, but I want to keep my original xaxis (another people have to use data and graphic output). Is there a way to solve my problem?
For example
clc clear all
%definition
t=733700:0.01:733715;y=0.5*sin(2*pi/(12.42*0.05)*t);
y1=0.45*sin(2*pi/(12.42*0.05)*t);y2=0.55*sin(2*pi/(12.42*0.05)*t);
%prepare for filling
T=[t,fliplr(t)];Y=[y1,fliplr(y2)];T_n=[t-t(1),fliplr(t-t(1))];
%graph
figure
subplot(2,1,1)
fill(T,Y,'r','EdgeColor','none','FaceAlpha',0.5);hold on;plot(t,y)
subplot(2,1,2)
fill(T_n,Y,'r','EdgeColor','none','FaceAlpha',0.5);hold on;plot(t-t(1),y)
Thanks in advance

답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by