Using embedded function in Simulink

I have used Embedded matlab function in Simulink ,three have written code for a sinewave,when i use scope i do not get sine wave i just get many straight lines ,please help

댓글 수: 2

Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 2일
Post your code
Pat
Pat 2012년 12월 2일
t=0:0.1:10;y1=sin(4*t);
y=reshape(bsxfun(@times,repmat(y1,3,1)',[1 3 5]),1,[]);
my stop time is 0.5 , i need increasing sine wave as like that code

댓글을 달려면 로그인하십시오.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 2일

0 개 추천

Pat, that's what I was expecting, the size of y is [1 303], that means your output will be a vector of 303 elements which will be displayed in your scope. Why are 'nt you using a sine wave block ? what do you to get exactly?

댓글 수: 7

Pat
Pat 2012년 12월 2일
Azzi i need a increasing sine wave in simulink ,as like the output of above code but my stop time must not exceed 2
Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 2일
If your stop time is 0.5, with sin(4*t), the period is pi/2, which means in 0.5 s you will display only a half period of a sine wave
Pat
Pat 2012년 12월 2일
ok Azzi can you tell how to get increasing sinewave in simulink,with stop time less than 2s
Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 2일
use 3 sine wave block with different amplitudes through a multiport switch, then set your frequency to at least 10 Hz
Pat
Pat 2012년 12월 2일
Azzi i used 3 sin blocks with constant as 2 ,but i get one sine wave as below,i have set amplitudes ro 1,2,3 respectively and frequency(rad/sec)to 10000,but it is decreasing and increasing
my mdl is
scope output
Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 2일
편집: Azzi Abdelmalek 2012년 12월 2일
Set the stop time to 1.99, the frequency of each sine wave blck to 56 Hz. The amplitudes to 1, 2 and 3
In configuration parameter set the fixed step size to 0.001
Pat
Pat 2012년 12월 2일
Thanks a lot Azzi

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

질문:

Pat
2012년 12월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by