# Thread: assigning particular value based on x asis

1. ## assigning particular value based on x asis

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

2. $\displaystyle y=0, x\in [2,3]$

3. what is the command for it in matlab

4. You never mentioned Matlab or what the signal was for $\displaystyle x<2$ and $\displaystyle x>3$

5. 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

6. Try this:

Code:
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))%<---------------------------------------------------
Regards Elbarto