Problem with command Fill
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
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!