Problem with command Fill
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!