signal generation model in Simulink from matlab

2019-09-24 18:14发布

问题:

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:

  1. Set the stop time of your model to 1000s and use a fixed-step solver with a step time of 1s.
  2. Use a Clock block with a decimation of 1. That's your 0:1000 vector.
  3. Feed the output of your Clock block to a Gain block, with the gain set to 1/(10000*pi). That's your t vector.
  4. Feed your t signal to two Trigonometric Function blocks, one set to sin and one set to cos. That will generate two signals, sin(t) and cos(t).
  5. Now multiply your t signal with your sin(t) signal using a Product block, to generate your x signal (t*sin(t)).
  6. Do the same thing with t and cos(t) to generate your y signal. z is already done since it's equal to t.

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.