How to implement an array in simulink?
이전 댓글 표시
x1=round(x1,3); x1=(0:0.001:50)'; y1=amplitude*sin(2*pi*x1/25)+1.75; This is the code to generate a sinewave function.Can someone please tell me how do we do this in simulink.I tried using a sin wave block as an input but that does not work.I have tried giving the input "x1' from workspace also.
답변 (2개)
Ameer Hamza
2018년 6월 17일
0 개 추천
You didn't explain what does not work with Sine wave block. See the attached Simulink model to see how to use the Sinewave block to generate the required waveform. Also look at the setting of the Sine wave block.
댓글 수: 5
Sanjal C C
2018년 6월 17일
Ameer Hamza
2018년 6월 17일
In that case, try the attached Simulink model. First, run the following line and then start the simulation
t = (0:0.001:50)';
x = [t 2*pi*t/25];
Sanjal C C
2018년 6월 17일
Sanjal C C
2018년 6월 17일
Ameer Hamza
2018년 6월 17일
What is the error?
Sanjal C C
2018년 6월 17일
0 개 추천
댓글 수: 4
Ameer Hamza
2018년 6월 17일
This is exactly the same as I gave in my comment, except that now you have 3 variables. You didn't write what is not working in the Simulink model I sent.
Sanjal C C
2018년 6월 17일
Ameer Hamza
2018년 6월 17일
You can use several From Workspace blocks to import several variables from base workspace. Also, you can send the data back using To workspace block. You cannot directly implement a MATLAB function in Simulink. Simulink function block requires that the function should be able to process on a stream of data points because you don't know the entire data sequence in advance.
Sanjal C C
2018년 6월 17일
카테고리
도움말 센터 및 File Exchange에서 Signal Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!