sir,
i have a signal.it ends at say x=2 in xaxis.
i want to assign zero valuefrom x=2 upto x=3 in xaxis.can u tell me which command should i use for it
clc;
clear all;
Ytot=0.0;
f=100000;
for j=1:1
R=4E+6; % Synchronized Rate (Max)
dt=1/R; % Sampling Time for output
t=0;
Y=0;
Y1=0;
N=5; % Number of cycles
L=N/(dt*f); % Length of signal
for i=1:L
Y1(i)=4*(1-cos(t*2*pi*f/N))* sin(t*2*pi*f);
t=t+dt;
end
for i=1:L
Y(i)=0.0;
end
Y=[Y Y1 ];
if j==1
Ytot=[Y];
else
Ytot=[Ytot Y];
end
end
t=([1:1:length(Ytot)])*dt;
subplot(2,1,1)
plot(t,Ytot);
-------------------------------------------------------------------
this is the signal
i want to add more zeros to the end of the signal upto my desired value corresponding to x axis
can u tell me which is the matlab command that i should use
Try this:
Regards ElbartoCode:clc; clear all; Ytot=0.0; f=100000; for j=1:1 R=4E+6; % Synchronized Rate (Max) dt=1/R; % Sampling Time for output t=0; Y=0; Y1=0; N=5; % Number of cycles L=N/(dt*f); % Length of signal for i=1:L Y1(i)=4*(1-cos(t*2*pi*f/N))* sin(t*2*pi*f); t=t+dt; end for i=1:L Y(i)=0.0; end Y=[Y Y1 ]; if j==1 Ytot=[Y]; else Ytot=[Ytot Y]; end end t=([1:1:length(Ytot)])*dt; h = subplot(2,1,1) plot(t,Ytot); set(h,'xlim',[0.6 0.9].*10^(-4))%<---------------------------------------------------