|
|
Using MATLAB to write signals to external devices
How can I use MATLAB as a signal generator?
Eg. Can I generate a sine wave on MATLAB and through the serial port, use this signal as an input to an am-fm generator?
|
|
0
|
|
|
|
Reply
|
Jaidev
|
7/12/2010 3:06:09 PM |
|
Jaidev Deshpande <deshpande.jaidev@gmail.com> wrote:
> How can I use MATLAB as a signal generator?
>
> Eg. Can I generate a sine wave on MATLAB
> and through the serial port, use this signal as an input
> to an am-fm generator?
Not a Matlab issue, but you can't.
No software can send a sine wave through a serial port.
It is a serial port, after all.
Now if you want to use a serial bus to control external
hardware that can generate a sine wave, then sure that
is quite doable. The exact details would depend upon
the external hardware of course, but generally you
would set up the serial port parameters to match that
of your external hardware, then write commands from
Matlab to the external hardware.
If you really want to generate waveforms in Matlab
and see them in the real world you'll want an AWG.
Here you would upload a sampling of the waveform
to the AWG and it would generate the signal you want.
If you want realtime analog signals then you'll want
a sig gen and you'll be sending signal parameters
( freq/amplitude/etc.) rather than a sampling.
If your "am-fm generator" can accept controls
via serial then you'll want to check the programming
manual and find out what to send.
But in no case are you going to be sending a sine
wave through the serial port. Just doesn't work that way.
regards
Stan
|
|
0
|
|
|
|
Reply
|
Stan
|
7/12/2010 3:54:28 PM
|
|
Hey Stan
Thanks. Basically I need to generate a rectangular wave with 10% duty cycle and multiply / modulate it with a higher frequency sine wave.
Unfortunately the generators I'm using are too crude (and the modulator is not programmable either) to give me a reasonably accurate rectangular form, and therefore I'm looking for digital signal sources.
I will look into the AWG. I'll be grateful if you can offer more suggestions. Thanks a lot.
Jaidev
|
|
0
|
|
|
|
Reply
|
Jaidev
|
7/13/2010 6:41:08 AM
|
|
Jaidev Deshpande wrote:
> Thanks. Basically I need to generate a rectangular wave with 10% duty
> cycle and multiply / modulate it with a higher frequency sine wave.
>
> Unfortunately the generators I'm using are too crude (and the modulator
> is not programmable either) to give me a reasonably accurate rectangular
> form, and therefore I'm looking for digital signal sources.
>
> I will look into the AWG. I'll be grateful if you can offer more
> suggestions. Thanks a lot.
The only values that an RS232 serial port itself can emit are "high" and
"low", with nothing in between.
RS232 serial port signals are (for this purpose) defined as
asynchronous: there is no common clock between the two ends and the time
gap between the end of one signal and the beginning of the next is not
fixed.
Higher-speed computer serial ports often have an RS422 option; RS422
uses differential signalling and so does not even have a clear "high" or
"low", but supports higher speeds and greater distances.
"serial ports" as a generic class include synchronous DS0 and T1 lines
and IBM bit-level protocols (unfortunately the name escapes me at the
moment), but you are unlikely to find those supported on a modern
computer without a special card, and most of them would not be suitable
for producing a reasonable approximation of a high-frequency sine. You'd
be better off with a D/A converter.
|
|
0
|
|
|
|
Reply
|
Walter
|
7/13/2010 1:42:00 PM
|
|
Jaidev Deshpande <deshpande.jaidev@gmail.com> wrote:
> Hey Stan
>
> Thanks. Basically I need to generate a rectangular wave with
> 10% duty cycle and multiply / modulate it with a
> higher frequency sine wave.
>
> Unfortunately the generators I'm using are too crude (and the
> modulator is not programmable either) to give me a reasonably
>accurate rectangular form, and therefore I'm looking
> for digital signal sources.
>
Well, a serial port is NOT in any reasonable sense a
signal generator. Forget the serial port- it is a dead
end for your needs.
You might take a look at a fast USB DIO module like
the Accessio DIO16A hooked to a vanilla DAC.
Sounds like you only need audio
frequencies so with an interface like this you could
do your modulation in software then stream the
resulting waveform digitally ( sample by sample).
You wouldn't get real time of course but close
enough for low frequencies ( you can stream at about
20M samples/sec ). With 16 bit DAC you'd have good
quality analog output. Basic poor mans's AWG.
Stan
|
|
0
|
|
|
|
Reply
|
Stan
|
7/13/2010 4:22:05 PM
|
|
|
4 Replies
379 Views
(page loaded in 1.538 seconds)
|
|
|
|
|
|
|
|
|