Hi everyone, currenly I'm working on this Fsk cde.How do I
make my Data signal to be random?What code should I insert?
Please help me..
A=2;
fm=2000;
fm1=4000;
fs=1000;
t=0:0.00001:0.003;
f0=A.*sin(2*pi*fm*t);
subplot(3,2,1);
plot(t,f0);
title('F0 signal');
f1=A.*sin(2*pi*fm1*t);
subplot(3,2,2);
plot(t,f1);
title('F1 signal');
Data= (square(2*pi*fs*t));%formula for Data signal
for i=1:length(Data)
Data(Data==-1)=0;
end;
subplot(3,2,3);
plot(t,Data);
title('Data signal');
x=f0.*Data;
Data1= (-square(2*pi*fs*t));
for i=1:length(Data1)
Data1(Data1==-1)=0;
end;
y=f1.*Data1;
z=x+y;
subplot(3,2,4);
plot(t,z);
title('Fsk Signal');
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/21/2007 2:52:08 AM |
|
In article <fadk0o$lqp$1@fred.mathworks.com>,
Siti naimah - <naimah_bentalib@yahoo.com.sg> wrote:
>Hi everyone, currenly I'm working on this Fsk cde.How do I
>make my Data signal to be random?
Well, what -kind- of randomness do you need? Uniform distribution?
Normal distribution? Poisson distribution?
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson
|
|
0
|
|
|
|
Reply
|
roberson2 (8067)
|
8/21/2007 7:21:50 AM
|
|
I need Normal pseudorandom distribution.U know like
11110010100011.How to make the array flip?
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/21/2007 9:18:59 AM
|
|
On Aug 21, 2:18 pm, "Siti naimah -" <naimah_benta...@yahoo.com.sg>
wrote:
> I need Normal pseudorandom distribution.U know like
> 11110010100011.How to make the array flip?
Seeing your previous post(s), I think you want 1's and 0's with equal
probability?
If so, rand(1,1000)>0.5 helps?
Krishna
http://dsplog.blogspot.com
|
|
0
|
|
|
|
Reply
|
krishna.pillai (106)
|
8/21/2007 12:02:27 PM
|
|
Krishna <krishna.pillai@gmail.com> wrote:
> Seeing your previous post(s), I think you want 1's and
0's with equal
> probability?
> If so, rand(1,1000)>0.5 helps?
> Krishna
> http://dsplog.blogspot.com
>
Thanks for your help but when I times the code above with
my data signal,like this: Data = rand(1,1000)>0.5.*(square
(2*pi*fs*t));.In the command window,it appears Error using
==> times
Matrix dimensions must agree.I'm really confuse.
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/22/2007 2:31:56 AM
|
|
"Siti naimah -" <naimah_bentalib@yahoo.com.sg> wrote in
message <fag76s$c38$1@fred.mathworks.com>...
> Krishna <krishna.pillai@gmail.com> wrote:
> > Seeing your previous post(s), I think you want 1's and
> 0's with equal
> > probability?
> > If so, rand(1,1000)>0.5 helps?
> > Krishna
> > http://dsplog.blogspot.com
> >
>
> Thanks for your help but when I times the code above with
> my data signal,like this: Data = rand(1,1000)>0.5.*(square
> (2*pi*fs*t));.In the command window,it appears Error using
> ==> times
> Matrix dimensions must agree.I'm really confuse.
>
well,
t=0:0.00001:0.003;
length(t)
ans =
301
You shouldn't really expect this to work..
what about rand(1,length(t))?
|
|
0
|
|
|
|
Reply
|
Joachim
|
8/22/2007 2:44:39 AM
|
|
"Joachim " <a@b.com> wrote in message
> well,
>
> t=0:0.00001:0.003;
> length(t)
> ans =
>
> 301
>
> You shouldn't really expect this to work..
> what about rand(1,length(t))?
Thanks for your opinion.Unfortunately,after putting the
code above,it still appears the same error.I've check the
length of t before but I thought its workable.What more
should I do?ohhh...so stress..my project due next week.Oh
go,help me...The array must flip.My lecturer has not been
much of help.
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/22/2007 7:27:59 AM
|
|
"Joachim " <a@b.com> wrote in message
> well,
>
> t=0:0.00001:0.003;
> length(t)
> ans =
>
> 301
>
> You shouldn't really expect this to work..
> what about rand(1,length(t))?
Thanks for your opinion.Unfortunately,after putting the
code above,it still appears the same error.I've check the
length of t before but I thought its workable.What more
should I do?ohhh...so stress..my project due next week.Oh
god,help me...The array must flip.My lecturer has not been
much of help.
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/23/2007 3:03:58 AM
|
|
"Siti naimah -" <naimah_bentalib@yahoo.com.sg> writes:
>
> "Joachim " <a@b.com> wrote in message
>> well,
>>
>> t=0:0.00001:0.003;
>> length(t)
>> ans =
>>
>> 301
>>
>> You shouldn't really expect this to work..
>> what about rand(1,length(t))?
>
> Thanks for your opinion.Unfortunately,after putting the
> code above,it still appears the same error.I've check the
> length of t before but I thought its workable.What more
> should I do?ohhh...so stress..my project due next week.Oh
> god,help me...The array must flip.My lecturer has not been
> much of help.
Then you must have another error. Without seeing what you're using
for code, we have no idea what the error might be...
You might want to use "dbstop if error" at the command line. You will
get a debugger prompt at the point of the error, which will let you
investigate the sizes of the variables at the time of the error.
-Peter
|
|
0
|
|
|
|
Reply
|
boettcher (2302)
|
8/23/2007 2:37:42 PM
|
|
After using the 'dbstop if error',the error is still the
same.It shows that error using=>> times.matix dimensions
must agree.There is no other error.I know I cannot just
multiply the rand together with the square wave but how?I
can't think of any oher way.Below is my code you wanted to
see.
A=2;
fm=1000;
fm1=2000;
fs=500;
t=0:0.00001:0.003;
f0=A.*sin(2*pi*fm*t);
subplot(3,2,1);
plot(t,f0);
%axis([0 0.019 -2 2])
title('F0 signal');
f1=A.*sin(2*pi*fm1*t);
subplot(3,2,2);
plot(t,f1);
%axis([0 0.019 -2 2])
title('F1 signal');
Data = (rand(1,100)>0.5).*(square(2*pi*fs*t));
for i=1:length(Data)
Data(Data==-1)=0;
end;
subplot(3,2,3);
plot(t,Data);
%axis([0 0.019 -2 2])
title('Data signal');
x=f0.*Data;
Data1 = (-square(2*pi*fs*t));
for i=1:length(Data1)
Data1(Data1==-1)=0;
end;
y=f1.*Data1;
z=x+y;
subplot(3,2,4);
plot(t,z);
%axis([0 0.019 -2 2])
title('Fsk Signal');
-Naimah-
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/24/2007 3:15:10 AM
|
|
Siti naimah - wrote:
> After using the 'dbstop if error',the error is still the
> same.It shows that error using=>> times.matix dimensions
> must agree.There is no other error.I know I cannot just
> multiply the rand together with the square wave but how?I
> can't think of any oher way.Below is my code you wanted to
> see.
....
Where precisely was the error? After the break, examine each of the
terms in the offending line for their size to see which isn't the
conforming one(s). Then, fix that/those...
--
|
|
0
|
|
|
|
Reply
|
none1568 (6639)
|
8/24/2007 3:31:08 AM
|
|
The error is in line: Data = (rand(1,100)>0.5).*(square
(2*pi*fs*t)); I've seen the size and does not tally but my
problem is I don't know how to fix that.
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/24/2007 6:56:57 AM
|
|
Siti naimah - wrote:
> The error is in line: Data = (rand(1,100)>0.5).*(square
> (2*pi*fs*t)); I've seen the size and does not tally but my
> problem is I don't know how to fix that.
� Data = (rand(1,100)>0.5).*(square(2*pi*fs*t));
??? Error using ==> .*
Matrix dimensions must agree.
� size(rand(1,100)>0.5)
ans =
1 100
� size(square(2*pi*fs*t))
ans =
1 301
�
It should be relatively clear what needs to be changed to make the two
sizes consonant...
--
|
|
0
|
|
|
|
Reply
|
none1568 (6639)
|
8/24/2007 1:45:50 PM
|
|
"Siti naimah -" <naimah_bentalib@yahoo.com.sg> wrote in message
news:falifu$72b$1@fred.mathworks.com...
> After using the 'dbstop if error',the error is still the
> same.It shows that error using=>> times.matix dimensions
> must agree.There is no other error.I know I cannot just
> multiply the rand together with the square wave but how?I
> can't think of any oher way.Below is my code you wanted to
> see.
>
> A=2;
> fm=1000;
> fm1=2000;
> fs=500;
> t=0:0.00001:0.003;
*snip code*
> Data = (rand(1,100)>0.5).*(square(2*pi*fs*t));
*snip more code*
When you use .*, at least one of the following conditions must be true:
1) The two arrays you're using must be exactly the same size.
2) One or both of the arrays you're using must be scalar (size [1 1])
Your first array is (rand(1,100)>0.5). What size is your first array?
Your second array is (square(2*pi*fs*t)). What size is your second array?
Are your first and second arrays the same size? Are one or both of them
scalar (is their size [1 1])? If the answers to both questions are no, you
need to change either the way you define the first array or the way you
define the second array (or both) so that they are the same size or one is a
scalar.
Some functions you may find useful:
SIZE
LENGTH
Also note you can call RAND with a variable or the output of a function call
instead of a number as the size of the random matrix to be created:
n = 10;
x = rand(1, n); % Creates a 1-by-10 random matrix
y = rand(size(x)); % Creates a random matrix the same size as x
--
Steve Lord
slord@mathworks.com
|
|
0
|
|
|
|
Reply
|
slord (13278)
|
8/24/2007 1:51:01 PM
|
|
I try the method for one or both arrays to be scalar,i.e:
size[1,1] but it's not workable for my square wave because
my data signal cannot be only one digit so I use the first
method,i.e: 2 arrays must be the same size.
t = 0:0.001:0.019;
fs =500;
n = 20;
y = rand(1,n); %Creates a 1-by-20 random matrix
d = y.*(square(2*pi*fs*t)); %Same matrix as y
plot(t,d);
However after I tried out the basic example above,I can't
get the square wave signal.Instead it looks like
triangular wave.How come?When I comment out the y and
declare the 1's and 0's like below,I still don't get a
perfect square wave.
t = 0:0.001:0.019;
fs =500;
n = 20;
x= [1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0];
%y = rand(1,n); %Creates a 1-by-20 random matrix
d = x.*(square(2*pi*fs*t)); %Same matrix as y
plot(t,d);
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/27/2007 8:01:08 AM
|
|
Siti naimah - wrote:
> I try the method for one or both arrays to be scalar,i.e:
> size[1,1] but it's not workable for my square wave because
> my data signal cannot be only one digit so I use the first
> method,i.e: 2 arrays must be the same size.
>
>
> t = 0:0.001:0.019;
> fs =500;
> n = 20;
> y = rand(1,n); %Creates a 1-by-20 random matrix
> d = y.*(square(2*pi*fs*t)); %Same matrix as y
> plot(t,d);
>
> However after I tried out the basic example above,I can't
> get the square wave signal.Instead it looks like
> triangular wave.How come?When I comment out the y and
> declare the 1's and 0's like below,I still don't get a
> perfect square wave.
>
> t = 0:0.001:0.019;
> fs =500;
> n = 20;
> x= [1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0];
> %y = rand(1,n); %Creates a 1-by-20 random matrix
> d = x.*(square(2*pi*fs*t)); %Same matrix as y
> plot(t,d);
Try
> t = 0:0.001:0.019;
> fs =500;
> n = 20;
> x= [1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0];
s = square(2*pi*fs*t);
> d = x.*(square(2*pi*fs*t)); %Same matrix as y
plot(t,x,'r'); hold on; plot(t,x,'g')
and see if that doesn't help understanding...
--
|
|
0
|
|
|
|
Reply
|
none1568 (6639)
|
8/27/2007 1:12:00 PM
|
|
Thank you.I've tried like what you say and after
increasing the increment to a 1-by-200 matrix,I get the
square wave signal.But when I want to make the square wave
random and insert--> y = rand(1,n); ,it becomes like some
noise wave.Is there any other code that can make my y min
to be '-1' and y max '1' come out randomly?I tried all
sorts of code already.
t = 0:0.0001:0.0199;
fs =100;
n = 200;
y = rand(1,n); %Creates a 1-by-200 random matrix
s = square(2*pi*fs*t);
plot(t,y);
--Naimah--
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/28/2007 3:05:43 AM
|
|
Siti naimah - wrote:
> Thank you.I've tried like what you say and after
> increasing the increment to a 1-by-200 matrix,I get the
> square wave signal.But when I want to make the square wave
> random and insert--> y = rand(1,n); ,it becomes like some
> noise wave.Is there any other code that can make my y min
> to be '-1' and y max '1' come out randomly?I tried all
> sorts of code already.
Someone provided that "trick" earlier but you seemed to have dropped
it...try
y = rand(1,n)>0.5;
for equi-probability. Note rand() is uniform and iirc you asked for a
normal distribution in an earlier post. randn() is the normal generator...
--
|
|
0
|
|
|
|
Reply
|
none1568 (6639)
|
8/28/2007 1:00:54 PM
|
|
Yes, I tried already but the space between the signals is
too near.How do I increase the space in between the
signals so that it will look more clear.and what should I
do if i want to reduce the no of cycles of the square wave
to 10.Is it by making a 1-by-10 matrix?
t = 0:0.0001:0.0199;
fs =100;
n = 200;
y = randn(1,n)>0.5; %Creates a 1-by-200 random matrix
d = y.*(square(2*pi*fs*t));
plot(t,d);
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/29/2007 2:38:17 AM
|
|
Siti naimah - wrote:
> Yes, I tried already but the space between the signals is
> too near.How do I increase the space in between the
> signals so that it will look more clear.and what should I
> do if i want to reduce the no of cycles of the square wave
> to 10.Is it by making a 1-by-10 matrix?
Well, to get 10 cycles at some frequency would require the length of the
time series to be the proper length to match. The resolution would
depend on the number of points.
It isn't at all clear what it is you're driving at here -- now that
you're beginning to get some familiarity w/ the nuts and bolts of
Matlab, you need to figure out what it is you're really after -- is it a
randomly changing frequency, a random distribution of on/off time
periods, what...
Once you have that defined clearly and unambiguously, then you can use
what you've learned to implement it.
I really don't know what the goal is from what you've posted so far. I
didn't really expect what you tried to be what you expected, but I don't
have enough of a picture of what you're expecting to tell you how to
proceed at this point...
--
|
|
0
|
|
|
|
Reply
|
none1568 (6639)
|
8/29/2007 3:49:10 AM
|
|
Ok.To have a clear picture for you,I've send the figure of
what I expect to your email.
|
|
0
|
|
|
|
Reply
|
naimah_bentalib1 (21)
|
8/29/2007 4:36:33 AM
|
|
|
20 Replies
194 Views
(page loaded in 0.233 seconds)
Similiar Articles: Random data signal - comp.soft-sys.matlabHi everyone, currenly I'm working on this Fsk cde.How do I make my Data signal to be random?What code should I insert? Please help me.. A=2; fm=2000;... Matlab code of Data Encryption Standard - comp.soft-sys.matlab ...Random data signal - comp.soft-sys.matlab Matlab code of Data Encryption Standard - comp.soft-sys.matlab ... Precise signal generation using matlab - comp.soft-sys.matlab ... Binary Data Source (Simulink Problem) - comp.soft-sys.matlab ...... rand (); y = round (x); w = y*1; z = 2*(w-0.5); %the O/P is Random Data NRZ Code ... us]ImageShack.us[/URL] the spectrum is not Sinc^2 or the Time Signal Is Rect ... $50,000 DSP Contest- data glitch fixed! - comp.dspPlease check out our contest seeking an algorithm for signal analysis data set. ... 1498,C 1499,A 1500,A END Please don=92t assume that the random sets of data ... top 10 uses for random data compression?? anyone? - comp ...IF compression of random data by 90% were indeed possible what would the top uses for ... You won't signal me upseting on to your legislative benefit. Tomorrow, it bears ... How do you combine pictures into 1 for ebay auction - comp ...top 10 uses for random data compression?? anyone? - comp ... Everyone signal ethnic greens, do you estimate them? ... evil load or university, and she'll shrilly combine ... How to get envelope from AM signal without phase shift - comp.dsp ...Working with captured data, that doesn't matter. (Think of the phase shifts ... >> >> In my simulations I generated a random signal by adding two Cosines with >> different ... ThinkVantage Access Connection - signal strength graph missing ...The list my TP produces does not show signal strength, unless the order of the ... top 10 uses for random data compression?? anyone? - comp ... With a decent internet ... Fourier transform of a random process - comp.dsp... said that a Fourier transform is not defined for a random ... easy to get, and easy to determine from measured data. ... -- Tim Wescott Control system and signal processing ... Generating PWM signals for testing ? - comp.lang.verilog ...Random testing (with suitable shaping and constraints) may be even better, and ... my question relates to using an external data file that holds >timing data of a signal ... Precise signal generation using matlab - comp.soft-sys.matlab ...... that device be custom or a signal generator; and B) If data rates is the aim rather than signal ... with the bus wait states -- and that should raise red ... Random ... Looking for a fast linear cross correlation implemented in C in ...- interrupt intser_McBSP1 is used to input two random signals via two channels(left and ... array for twiddle constants Complex x[N_FFT]; //N_FFT complex data values ... instructor's solutions manual for Probability, Statistics, and ...... solutions manual for Probability, Statistics, and Random ... solutions manual for A Practical Introduction to Data ... instructor solutions manual for An Introduction to Signals ... What is the meaning of 'combinatorial path crossing multiple units ...> > It is, > "Combinatorial path crossing multiple units drives a signal. The ... top 10 uses for random data compression?? anyone? - comp ..... aggression" and an "act ... Ceiling Fan RF Remote Compatibilty - comp.home.automation ...Just get a 315MHz transmitter module and send it the IR signal. It will work just ... top 10 uses for random data compression?? anyone? - comp ... To be maximum or remote ... Amazon.com: Random Signals: Detection, Estimation and Data ...Random Signals, Noise and Filtering develops the theory of random processes and its application to the study of systems and analysis of random data. The text covers ... Random signals: detection, estimation, and data analysis - K. Sam ...Random Signals, Noise and Filtering develops the theory of random processes and its application to the study of systems and analysis of random data. The text covers ... 7/22/2012 5:25:44 AM
|