How to convert sine wave signal to square wave in Simulink?

Use sign(sine(wt))

On Wed, 13 Feb 2013 14:43:01 -0800, fabian.uriarte wrote: > Use sign(sine(wt)) Well, yeah... but the OP may want to increase the sample rate a bit.

0 |

2/14/2013 1:40:11 AM

I have a Inverter with a DC input and output as a Square wave. My aim was to convert this DC input into an AC Sine wave. Therefore, I had placed LC filter at the output of the inverter. I did get a square wave which has the same amplitude as that of the input DC voltage. But when I convert this into a sine wave, the amplitude is decreased irrespective the values I change. The following are the parameters I have used: DC input : 170 V Inverter: 2-arm four diode Universal Bridge (Ideal Switches) PWM Generator: Carrier Frequency (triange wave frequency) : 9000hz Sine wave Frequency : 377 rad/ sec Triangle wave amplitude: 2 V Sine wave amplitude: 1 V LC filter (low pass): L = 2.5mH C = 5.3uF Can anyone please let me know what I need to change to have my converted Sine wave an amplitude of 170 V or atleast 150 V. Thanks in advance. ...

Hi I would like to sample a sing wave with a square wave. Can anyone help me how to implement it in MATLAB On Jul 4, 11:07 am, fas <faisalmu...@gmail.com> wrote: > Hi > I would like to sample a sing wave with a square wave. Can anyone help > me how to implement it in MATLAB In other words I want to convolve a sine with a square wave(rect) > In other words I want to convolve a sine with a square wave(rect) You can create a sampled sine wave using the sin function (the result is a vector). You can create a rectangular wave (vector) by using a hard limiter on a DC shifted sine wave. The use the conv command - this is the numerical result. I'm not sure how you would go about getting a symbolic answer for this in Matlab ...

I am trying to pass to square wave signal into math script. I am assumeing that i have to convert the signal into a double. Is this possible? If so how could I convert this signal so it can be passed into math script? Thanks,Leif Which data type does your square wave signal has? If it is a waveform you can get the value as an array of double with the Get Waveform Components primitve. ...

Hi, I have a question that seems simple but is surrounding my mind. From my understanding, a signal can be represented by its in-phase and quadrature componentes (which are low pass signals). The relationship is the following A(t)*cos(wt +phi(t) ) = si(t) * cos(wt) - sq(t) * sin(wt) , being si(t) and sq(t) the associated I and Q signals respectively. So, imagine I have just cos(wt), does it means that si(t) is always = 1? I.e, samples IQ IQ IQ IQ IQ IQ would be And what about sin(wt), would be sq(t) = -1 amd si(t) = 1, i.e. samples IQ IQ IQ IQ IQ IQ would be 0-1 0-1 0-1....? Regards, On 6/1/12 1:36 PM, MRR wrote: > > I have a question that seems simple but is surrounding my mind. From my > understanding, a signal can be represented by its in-phase and quadrature > componentes (which are low pass signals). The relationship is the > following > > A(t)*cos(wt +phi(t) ) = si(t) * cos(wt) - sq(t) * sin(wt) , being si(t) > and sq(t) the associated I and Q signals respectively. > > So, imagine I have just cos(wt), does it means that si(t) is always = 1? > I.e, samples IQ IQ IQ IQ IQ IQ would be > > And what about sin(wt), would be sq(t) = -1 amd si(t) = 1, i.e. samples IQ > IQ IQ IQ IQ IQ would be 0-1 0-1 0-1....? > i can't quite figure out what's behind the question here. if it is as simple as: if s(t) = si(t)*cos(wt) - sq(t)*sin(wt) and if s(t) = co...

How to convert a sound signal with a dark green wire of a wave file path into a input signal data typ wire? We want to compare a signal comming from the micro with a sound on the computer? Can somebody pls help us? We are making a guitar, and the VI must compare and find the accords. Our VI is included. Greets from belgium. Geluid.vi: http://forums.ni.com/attachments/ni/170/156235/1/Geluid.vi ...

Hi, I am trying to generate a quasi square wave signal, y=cos(wct+kpm(t)), where fc=960e6Hz, kp=45/ 90/ 120 degrees phase deviation, m(t)=sin (wmt)+sin(3wmt) +sin (5wmt) +sin (7wmt) where fm=100KHz. I tried implementing this equation in Simulink using the sine wave function but received the error: undefined t. Can somebody please let me know how to go about it? Thanking you in advance. ...

How can I generate a 2GHz sine wave in simulink?The signal generater does not produce a perfect sine wave. It is distorted in amplitude at specific times. ...

Dear all, I am working with Matlab Simulink (Matlab R2009b) for DSP (Digital Signal Controller), i need a digital sinwave so that i create the steps following: 1. Testing with continuous model: + A Pulse generator at 500 Hz connecte with + A Band pass Filter at f0=500Hz (Q=100); H(s)=([31.42 0], [1 31.42 9869604]) + A scope display the result, With some parameters: Simulation -> Configuration Parameters -> Fixed-step; ode3; t(sample)=1e-5 It works well, it means the result is a sinwave at 500Hz 2. Testing with discrete model: + A Pulse generator at 500 Hz connecte with + A Band pass Filter at f0=500Hz (Q=100); i used the command "H(z)=c2d(H(s), 0.000005,'foh')" for converting from continuous to discrete time models. The results is H(z)=([7854e-5 -4.113e-9 -7.854e-5], [1 -2 0.9998]) + A scope display the result With some parameters: Simulation -> Configuration Parameters -> Fixed-step; discrete; t(sample)=1e-5/ Auto/ 5e-6 ... (i tested with some different values) But it does not work Please help me to explain why it does not work P/S: I have already seen an exemple * to creat a digital sinwave by creating a table, but i prefer this method. * http://www.mathworks.com/products/simulink/demos.html?file=/products/demos/shipping/simulink/sldemo_wavethd_script.html "BUI Dang Thanh" <buidangthanh@yahoo.com> wrote in message news:hvn5jt$eq3$1@fred.mathworks.com... > Dear all, >...

Hi, I put together a VI to calculate the FFT of a sine wave signal and graph the result in the frequency domain. In theory, if we take the Fourier Series of a 500Hz sine wave signal, we should see a spike at 500 Hz in the frequency domain. However, the result I got is very noisy and there are spikes everywhere. Could you please take a look at the VI and let me know what is missing? Thanks everyone for you help in advance. fft.vi: http://forums.ni.com/attachments/ni/170/163587/1/fft.vi Hiiii, I think you should use the special kit to take the fft, which will give you the perfect answer, here i am attaching a figure,which will show you that how perfect it is by using the special express vis, bcoz they are also given with the sensor sensitivity and ave. paras, which will give u the exact idea. Thanks, Nishant Hiiii, I think you should use the special kit to take the fft, which will give you the perfect answer, here i am attaching a figure,which will show you that how perfect it is by using the special express vis, bcoz they are also given with the sensor sensitivity and ave. paras, which will give u the exact idea. i forgot to attach the figure in last response. Thanks, Nishant Message Edited by Nishant on 01-26-2006 ...

i need matlab code for p wave detection in ecg signal "Taposh karmokar" wrote in message <n1nd8j$g16$1@newscl01ah.mathworks.com>... > i need very badly this code(p wave detection in ecg signal )...plz help me I need too... Can you help me? ...

My project need to generate a sinewave using matlab which has 1 lakh samples and the frequency changes randomly after every 10,000 samples. the fs and the frequencies can be as per convenience.Is there any function in matlab to generate this. Pls hint me with any example. thank you. "sayantani" wrote in message <jgue5d$8d0$1@newscl01ah.mathworks.com>... > My project need to generate a sinewave using matlab which has 1 lakh samples and the frequency changes randomly after every 10,000 samples. the fs and the frequencies can be as per convenience.Is there any function in matlab to generate this. Pls hint me with any example. thank you. I would generate the ten segments independently and then concatenate them: fs = 44100; % choose your own maxFreq = 20000; % choose your own t = (0:10000-1)/fs; wave = []; for idx = 1:10 freq = maxFreq*rand; segment = sin(2 * pi * freq * t); wave = [wave segment]; end ...

Dear all, I am working with Matlab Simulink (Matlab R2009b) for DSP (Digital Signal Controller), i need a digital sinwave so that i create the steps following: 1. Testing with continuous model: + A Pulse generator at 500 Hz connecte with + A Band pass Filter at f0=500Hz (Q=100); H(s)=([31.42 0], [1 31.42 9869604]) + A scope display the result, With some parameters: Simulation -> Configuration Parameters -> Fixed-step; ode3; t(sample)=1e-5 It works well, it means the result is a sinwave at 500Hz 2. Testing with discrete model: + A Pulse generator at 500 Hz connecte with + A Band pass Filter at f0=500Hz (Q=100); i used the command "H(z)=c2d(H(s), 0.000005,'foh')" for converting from continuous to discrete time models. The results is H(z)=([7854e-5 -4.113e-9 -7.854e-5], [1 -2 0.9998]) + A scope display the result With some parameters: Simulation -> Configuration Parameters -> Fixed-step; discrete; t(sample)=1e-5/ Auto/ 5e-6 ... (i tested with some different values) But it does not work Please help me to explain why it does not work P/S: I have already seen an exemple * to creat a digital sinwave by creating a table, but i prefer this method. * http://www.mathworks.com/products/simulink/demos.html?file=/products/demos/shipping/simulink/sldemo_wavethd_script.html ...

Dear all, I am working with Matlab Simulink (Matlab R2009b) for DSP (Digital Signal Controller), i need a digital sinwave so that i create the steps following: 1. Testing with continuous model: + A Pulse generator at 500 Hz connecte with + A Band pass Filter at f0=500Hz (Q=100); H(s)=([31.42 0], [1 31.42 9869604]) + A scope display the result, With some parameters: Simulation -> Configuration Parameters -> Fixed-step; ode3; t(sample)=1e-5 It works well, it means the result is a sinwave at 500Hz 2. Testing with discrete model: + A Pulse generator at 500 Hz connecte with + A Band pass Filter at f0=500Hz (Q=100); i used the command "H(z)=c2d(H(s), 0.000005,'foh')" for converting from continuous to discrete time models. The results is H(z)=([7854e-5 -4.113e-9 -7.854e-5], [1 -2 0.9998]) + A scope display the result With some parameters: Simulation -> Configuration Parameters -> Fixed-step; discrete; t(sample)=1e-5/ Auto/ 5e-6 ... (i tested with some different values) But it does not work Please help me to explain why it does not work P/S: I have already seen an exemple * to creat a digital sinwave by creating a table, but i prefer this method. * http://www.mathworks.com/products/simulink/demos.html?file=/products/demos/shipping/simulink/sldemo_wavethd_script.html ...

I am trying to generate a sine wave whose frequency changes dynamically during simulation. The frequency should come as input to the sinewave block from another block. I would be grateful for any suggestion or help "satya mishra" <dudesatya@in.com> wrote in message <hrsok4$lg5$1@fred.mathworks.com>... > I am trying to generate a sine wave whose frequency changes dynamically during simulation. The frequency should come as input to the sinewave block from another block. > > I would be grateful for any suggestion or help There is no block shipped with Simulink to directly do that. You need to implement the equation y = sin(w*t + phi) using basic blocks like sum, product and trigo. Guy Well the problem with that kind of implementation is to include simulation time 't'. 'w' can be worked out as 2*pi*dynamic value of 'f'. thanks satya "satya mishra" <dudesatya@in.com> wrote in message <hrsrsk$ldb$1@fred.mathworks.com>... > Well the problem with that kind of implementation is to include simulation time 't'. 'w' can be worked out as 2*pi*dynamic value of 'f'. > thanks > satya The Clock block (look in the Sources section of the library browser) can provide you the simulation time. http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/clock.html http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/digitalclock.h...

im a biomeidical instrumentation student..i need a matlab code for neural network based R wave detection in QRS complex in an ecg signal ..i kindly request you to help me.. "josy joy" <josyjoyvarghese@yahoo.co.in> wrote in message news:il0b89$c6i$1@fred.mathworks.com... > im a biomeidical instrumentation student..i need a matlab code for neural > network based R wave detection in QRS complex in an ecg signal ..i kindly > request you to help me.. This sounds like a highly specialized code; I doubt you'll find anyone with that specific application ready-made. You should work on implementing it yourself; if you have SPECIFIC questions you need answered during that process, ask those specific questions in the newsgroup. -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com ...

I added 3 sine waves together to produce a signal. Sine Wave 1: Amplitude=1, Frequency=55 hz Sine Wave 2: Amplitude=0.39, Frequency=52.87 hz Sine Wave 3: Amplitude=0.34, Frequency=57.54 hz The starting phase for all 3 sine waves is zero. Is it possible for me to reproduce this signal using a single sine wave o variable frequency and amplitude? (i mean use a sine oscillator, an control the frequency using one data table and control the amplitude usin another data table) If so, what method would you suggest for deriving the frequency contro data? I wrote a program in Scilab to derive the amplitude curve, it work beautifully. I started on a program in Scilab to derive the frequency curve. Th method that I have in mind is to calculate a frequency value for eac local maxima in the signal by calculating the time difference between eac local maxima, then interpolate the frequency curve linearly between thes points. However, I wonder if there's a better method for deriving the frequenc curve from the signal. Perhaps some kind of sine wave pattern matchin algorithm. Can anyone suggest anything? Thanks, any help would be much appreciated On 28 Nov, 05:52, "maxplanck" <erik.bo...@comcast.net> wrote: > I added 3 sine waves together to produce a signal. > > Sine Wave 1: Amplitude=1, Frequency=55 hz > Sine Wave 2: Amplitude=0.39, Frequency=52.87 hz > Sine Wave 3: Amplitude=0.34, Frequency=57.54 hz > > The starting phase for al...

Dear folks, I have a wave which i have acquired and need to figure out by means of a code what kind of wave is it. Is it a sine wave, Square Wave, Triangular wave... I did make a small program which takes the fft of the acquired wave and deconvolutes it against the fft of a standerd wave. This works fine with a pure wave and is very predictable. I then tried using the same with a realworld signal, but the noise in the wave upsetted all the value ranges. Can someone sugggest a better meathod?? Ankur Corelate.vi: http://forums.ni.com/attachments/ni/170/185805/1/Corelate.vi antea06, Tried that. the problem is that incase my acquired wave is essentially a square wave, the edge is distorted on filltering and the fft of the data after deconvolution is then very close to a sine wave. So i tried the commmunities. I tried digitizing the wave and removing the lsb values of the wave. It resulted in the sine and triangular wave having very simmilar charecteristics. Thaught i could use a lock in amplifier to extract the vave, but all it gives us is a single point value in intensity of the reference wave. Thanking You Ankur Kumar ...

I want to compute the fourier coefficients of a square wave with height 1 and length 1 . According to the real fourier transform, the result should be F(z)=sin(pi*z)/(pi*z). This means the maximum value should be 1. Can anyone explain me why I get growing max values of the discrete fourier coefficients as the smaller discretization step I use ? Here is my code: % "square function" f = @(t) (heaviside(t+1/2) - heaviside(t-1/2)); % compute the fourier coefficients t = linspace(-2,2); F = fft(f(t)); % plot the coefficients (should be a real function) plot(t,fftshift(real(F))) On May 10, 8:43=A0am, "Tomas " <tomas...@gmail.com> wrote: > I want to compute the fourier coefficients of a square wave with height 1= and length 1 . According to the real fourier transform, the result should = be F(z)=3Dsin(pi*z)/(pi*z). This means the maximum value should be 1. > > Can anyone explain me why I get growing max values of the discrete fourie= r coefficients as the smaller discretization step I use ? > > Here is my code: > > % "square function" > f =3D @(t) (heaviside(t+1/2) - heaviside(t-1/2)); > > % compute the fourier coefficients > t =3D linspace(-2,2); > F =3D fft(f(t)); > > % plot the coefficients (should be a real function) > plot(t,fftshift(real(F))) Can't you work it out? When you halve the step, what happens to the magnitude of the DFT? Now halve it again to check that the pattern is co...

can any one please help me in creatind a sine wave in C/C++ please i also need to play it as a .wav file any random sound within sudible frequency will do decorr wrote: > can any one please help me in creatind a sine wave in C/C++ please > i also need to play it as a .wav file any random sound within sudible > frequency will do ??? Do you need a sine wave on a wav file, or do you need an arbitrary sound that is audible? You'd have to be more specific in describing what you need if you want us to give you a hand. Carlos -- decorr wrote: > can any one please help me in creatind a sine wave in C/C++ please > i also need to play it as a .wav file any random sound within sudible > frequency will do #define N 1024 short sound[N]; int k; for(k = 0;k < N/4;k++) { sound[4*k] = 0x7FFF; sound[4*k+1] = 0; sound[4*k+2] = 0x8000; sound[4*k+3] = 0; } john wrote: > decorr wrote: > >>can any one please help me in creatind a sine wave in C/C++ please >>i also need to play it as a .wav file any random sound within sudible >>frequency will do > > > #define N 1024 > > short sound[N]; > int k; > > for(k = 0;k < N/4;k++) { > sound[4*k] = 0x7FFF; > sound[4*k+1] = 0; > sound[4*k+2] = 0x8000; > sound[4*k+3] = 0; > } Dear god, that's going to hurt like hell! ;-) Carlos -- Carlos Moreno wrote: > john wrote: > >> decorr wrote: >> >>> can ...

I am taking the FFT of a sine wave using the following commands: N=3000;t=(1:N);f1 = .01*2*pi; d = sin(f1*t);fd = fft(d); According to the equations given in the matlab help files on the FFT, I should get: fd(31) = -i*1500 fd(2971) = i*1500 and all other fd values should be zero. however, I actually get: fd(31) = -i*1497.05 + 94.185 fd(2971) = i*1497.05 + 94.185 Can anyone tell me why the FFT result is not purely imaginary? Any help is greatly appreciated. Thanks, Jason jason wolfe wrote: > I am taking the FFT of a sine wave using the following commands: > > N=3000;t=(1:N);f1 = .01*2*pi; > d = sin(f1*t);fd = fft(d); > > According to the equations given in the matlab help files on the FFT, > I should get: > fd(31) = -i*1500 > fd(2971) = i*1500 > and all other fd values should be zero. > > however, I actually get: > fd(31) = -i*1497.05 + 94.185 > fd(2971) = i*1497.05 + 94.185 > > Can anyone tell me why the FFT result is not purely imaginary? > Any help is greatly appreciated. > > Thanks, > Jason What it's telling you is that the phase of the sin wave is non-zero. This means you are not starting at time t= 0, where the sine is zero. Try this: N=3000;t=(0:N-1);f1 = .01*2*pi; d = sin(f1*t);fd = fft(d); ...

Hi all could anyone let me know" the significance of sine wave integration" On 3/29/2011 10:57 PM, harish bharadwaj wrote: > Hi all > could anyone let me know" the significance of sine wave integration" Can you be more clear what you mean? The question is not clear. --Nasser On Mar 30, 6:57=A0pm, "harish bharadwaj" <harishhru...@gmail.com> wrote: > Hi all > could anyone let me know" the significance of sine wave integration" Yes. The answer is: 42 See: http://en.wikipedia.org/wiki/42_%28number%29 ...

Hello, I'm a Mathlab rookie and I need some help with the following problem: I have measured data of basically a square wave (current vs time). I managed to upload the data with mathlab and I can plot the data. But now I would like to know the height of the blocks of my square wave, so the amplitude. For that I would like to take the average of the maximum value of all blocks of my wave minus the average of the minimum block value of the wave. Has anyone an idea how that would be possible in mathlab? Thanks a lot in advance!!!! "Rena" wrote in message <iom8jt$1sl$1@fred.mathworks.com>... > Hello, > I'm a Mathlab rookie and I need some help with the following problem: > > I have measured data of basically a square wave (current vs time). I managed to upload the data with mathlab and I can plot the data. But now I would like to know the height of the blocks of my square wave, so the amplitude. For that I would like to take the average of the maximum value of all blocks of my wave minus the average of the minimum block value of the wave. Has anyone an idea how that would be possible in mathlab? > > Thanks a lot in advance!!!! Hi Rena, Welcome to MATLAB! If you have a square wave, then why not take the mean of the absolute value? t = 0:.0001:.0625; % square wave corrupted by noise y = square(2*pi*30*t)+0.02*randn(size(t)); plot(t,y); mean(abs(y)) Wayne ...

Hi, Regarding DFT, I have done signal analysis on the effect of varying DFT length and Signal length, and i can see that by increasing this 2 parameters can actually increase the resolution and reduce the spectral leakage. The analysis i did was on Sine wave. However for square wave, the parameter for its signal analysis is just the frequency? Does the Sampling Frequency affect the square wave spectral analysis? N( signal length) and R(DFT length) and windowing methods will not affect square wave signal analysis, is it true? What other parameter can help me in analysis? Thank you so much!! On Dec 9, 2:08=A0am, "Joey W" <joeyws...@hotmail.com> wrote: > Hi, > Regarding DFT, I have done signal analysis on the effect of varying DFT l= ength and Signal length, and i can see that by increasing this 2 parameters= can actually increase the resolution and reduce the spectral leakage. The = analysis i did was on Sine wave. > > However for square wave, the parameter for its signal analysis is just th= e frequency? Does the Sampling Frequency affect the square wave spectral an= alysis? > N( signal length) and R(DFT length) and windowing methods will not affect= square wave signal analysis, is it true? What other parameter can help me = in analysis? > > Thank you so much!! dt =3D 1/Fs T =3D N*dt t =3D dt*(0:N-1); t =3D 0:dt:T-dt; t =3D linspace(0,T-dt,N) df=3D 1/T Fs =3D N*df f=3D df*(0:N-1); f =3D 0:df:Fs-df; f =3D linspace(0,Fs-df,N) Regar...

Hi, I need to detect a presence of square wave. If square wave is there I need to generate a logic 0 and this square wave is not present I need to generate logic 1 or vise versa. Can you suggest me a circuit for this functionality. Thanks in advance Regards Pinku pinku wrote: > Hi, > I need to detect a presence of square wave. If square wave is there I > need to generate a logic 0 and this square wave is not present I need > to generate logic 1 or vise versa. Can you suggest me a circuit for > this functionality. First, you have to do a lot better than that at defining "square wave". You might be surprised at the variety of signals that have been called square waves. "pinku" <praveenkumar.bm@gmail.com> wrote in message news:1194110521.868836.186370@k35g2000prh.googlegroups.com... > Hi, > I need to detect a presence of square wave. If square wave is there I > need to generate a logic 0 and this square wave is not present I need > to generate logic 1 or vise versa. Can you suggest me a circuit for > this functionality. Does your signal line have only a square wave on it, or are there other things present when the square wave isn't? Is the squarewave centered on zero (so it goes positive and negative) or does it have zero as its floor? What is the magnitude (volts) of the signal? What's the period (or frequency) of the square wave? Greg Neill wrote: > > "pinku" <praveenkumar.bm@gm...

In the aftermath of an earthquake, every second counts for disaster victims. Imagine a system that can locate people quickly and help first responders ...

... platform, enable diverse teams to collaborate, share, review, analyze and trace designs built in IBM Rational Rhapsody and The Mathworks Simulink. ...

The picture above looks like a standard four-wheel drive (4WD) touring car. As one looks closer, a few strange things start to pop out. Where’s ...

See top IAR Embedded Workbench professionals, groups, and related job openings.

The MathWorks - Developers of MATLAB, Simulink and Stateflow. Offers products for data analysis, visualization, application development, simulation, ...

Picture of the internals of an ADSL modem / router . A modern example of an embedded system. Labelled parts include a microprocessor (4), RAM ...

... produces biosignal amplifiers, data acquisition systems, real-time processing systems and EEG Processing Software under Matlab and Simulink. ...

CFOworld.com.au covers accounting, risk management, taxation, technology and financial news from ASX-listed companies.

Curriculum Vitae - Stefano Meroli

Virtual Reality and Animation for MATLAB® and Simulink® Users Nassim Khaled This book demonstrates the simulation and animation of physical ...

Resources last updated: 3/31/2016 3:53:28 AM