Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
how can i extend my graph to 10 secs by replicating it??
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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'))
0 comentarios
Respuestas (1)
Image Analyst
el 23 de Ag. de 2014
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 comentarios
Image Analyst
el 24 de Ag. de 2014
Did you try my suggestion of xlim()??? I imagine you must have by now , but it would look something like this:
xlim([-1, 10]);
La pregunta está cerrada.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!