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!