フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how can i extend my graph to 10 secs by replicating it??

1 回表示 (過去 30 日間)
Nabhdeep Bansal
Nabhdeep Bansal 2014 年 8 月 23 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
t=[-1;-0.8;-0.6;-0.4;-0.2;0;0;0.2;0.4;0.6;0.8;0.8;1;];
Y=[-1;-1;-1;-1;-1;-1;1;1;1;1;1;-1;-1;]';
f=0;
N=10;
hold on;
h=zeros(N,1);
clr=lines(N);
for n=1:2:N;
line(t,Y,'linewidth',5)
grid on;hold on;
A=0.5*trapz(t,Y);
P=Y.*(cos(n*pi*t))';
Q=Y.*(sin(n*pi*t))';
Ax=trapz(t,P);
Bx=trapz(t,Q);
f=f+(Ax*cos(pi*n*t)+Bx*sin(pi*n*t));
final=A+f;
h(n)=plot(t,final,'linewidth',2,'Color',clr(n,:));
end
hold off;
legend(h, num2str((1:N)','harmonic-%d'))

回答 (1 件)

Image Analyst
Image Analyst 2014 年 8 月 23 日
Replicating the graph ??? Like with subplot() or axes() so that you have two graphs/plots/axes???? Or do you mean replicating your data (with repmat)? Or extending the t axis out to 10 with xlim)? Please clarify!
  2 件のコメント
Nabhdeep Bansal
Nabhdeep Bansal 2014 年 8 月 24 日
Sir, I meant extending the t axis out to 10 mins.
Image Analyst
Image Analyst 2014 年 8 月 24 日
Did you try my suggestion of xlim()??? I imagine you must have by now , but it would look something like this:
xlim([-1, 10]);

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by