问题
How do I generate following signal in simulink:
t=(0:1000)/1000*10*pi;
I want to build the model of the following matlab code:
t=(0:1000)/1000*10*pi;
x = (t).*sin(t);
y = (t).*cos(t);
z = t;
回答1:
This is fairly basic stuff. Have you gone through any Simulink tutorial, introduction videos/webinars or even the getting started guide of the documentation?
Here are a few suggestions to help you answer your question:
- Set the stop time of your model to 1000s and use a fixed-step solver with a step time of 1s.
- Use a Clock block with a decimation of 1. That's your
0:1000
vector. - Feed the output of your Clock block to a Gain block, with the gain set to
1/(10000*pi)
. That's yourt
vector. - Feed your
t
signal to two Trigonometric Function blocks, one set tosin
and one set tocos
. That will generate two signals,sin(t)
andcos(t)
. - Now multiply your
t
signal with yoursin(t)
signal using a Product block, to generate yourx
signal (t*sin(t)
). - Do the same thing with
t
andcos(t)
to generate youry
signal.z
is already done since it's equal tot
.
EDIT following comments
The answer to your comment is really basic Simulink stuff. You should learn how to use Simulink before trying to do advance stuff like VR in Simulink. It's a bit like trying to run before you can walk.
Here are a few resources that may be useful:
- Simulink Videos and Examples
- Simulink Webinars
- Simulink tutorial
- Getting Started with Simulink in the Simulink Documentation
I don't know much about VRML, but be aware that the coordinate system in VRML is different from that in MATLAB/Simulink (see http://www.mathworks.co.uk/help/sl3d/vrml.html). You should also have a look at Virtual World Connection to a Model in the Simulink 3D Animation documentation.
来源:https://stackoverflow.com/questions/20940517/signal-generation-model-in-simulink-from-matlab