Problem with command Fill

2 vues (au cours des 30 derniers jours)
Miguel Ángel
Miguel Ángel le 13 Déc 2013
Modifié(e) : Miguel Ángel le 13 Déc 2013
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

Réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by