how to apply a signal after a period of time in simulink [closed] - matlab

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I simulated a system with Simulink. Now , I want to apply controller signal to system
after a time, for example after 20 seconds. It means that the sys. works 20s without
controller and after it the controller is applied.
Which block can do it?

Put the controller inside a Triggered Subsystem and set the trigger signal to go high after 20s, for example using a Clock block and a Compare to Constant block, set to >=20.

Related

How should I implement the function to choose the route i want? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a simple network that has several routes from start to end. Vehicles from a transporter fleet will carry agents from the left conveyor to the right conveyor using the moveByTransporter block. What are some syntax i can use to refer to paths/nodes on the network?
Also, what is a sample code line of how i can check the number of vehicles on a specific path?
This is my sample network and idea of trying how to make a new routing instead of just the shortest path (the path i want to follow is via the yellow highlighted one)
The moveTo block will take the route with the shortest distance. If the agent's speed is the same across all choices, then the shortest distance will also be the fastest time.
In the past, I have used Dijkstra's algorithm and manually routed my agents from a to b, then b to c, etc. This way, I could use travel times instead of just distances. This also opens up the possibility of considering congestion by applying a penalty to some segments if there are too many other agents on them. You can also pick a route, but then when you get to the next node, re-calculate the rest of the route for updated congestion considerations.
This is all custom, and I would not recommend it for simple problems. You would be better off to look at other alternatives (assume constant speeds or consider the pedestrian library with walls, etc, depending on your problem).

What is the matrix diagonalization precision in matlab? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I don't know what kind of algorithm it runs in the background but it seems that it cannot handle matrices which contain elements on the order of 10^-5.
It can handle upto 16 digits. Type:
format long;
a = 1.234567890123456;
in your MATLAB code or command window.
4 decimal places is the limit of format short.

Having trouble proving relation is not necessary for RMS real-time scheduling to be true. [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I can see how to solve the right side of the equation but when not knowing what C and T are how can I prove it is not necessary and confirm it is sufficient?
I thought about changing the C/T to a variable such as x and starting from N = 1 and solving for x at each step until the RHS is not >= to the LHS. Is this a correct way to go about this?
As the questions stated the bound you provided n(2^(1/n)-1) is sufficient in the sense that if it is true then the set of tasks is schedulable but it is not complete, it will reject task sets that are still schedulable under RMS. A simple example is a harmonic task set. A harmonic task set is one where each period is is an exact multiple of all the tasks with small periods. A trivial example is the task set of two tasks each with a capacity of 1 and a period of 2. It has 100% utilization and is schedulable under RMS but its utilization is greater than the percentage 0.828 listed in the chart for N=2.
In general, to determine if a task set is schedulable under RMS the follow recurrence relationship is solved for each task i:
If this value is less than T_i for each task assuming implicit deadlines) than the task set is schedulable.

Need help in modelling a delay element in Simulink [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to generate a pulse which steps from 0 to 1 after an initial predetermined time has elapsed. When the new predetermined time is available, the pulse should again step from 1 to 0. It should step from 0 to 1 after that time has elapsed. This model has to be implemented in Simulink.
Thanks.
I'm assuming that the times at which the on/off behaviours are to be performed are available before the model simulation begins. Let's say that it's 2 seconds of value 0 and then 3 seconds of value 1.
Use the Pulse Generator block in the Sources library of Simulink. The trick is starting with a zero. To do this, set the Amplitude to 1 second, the Period to 5s, the Pulse Width to 60% and the Phase Delay to 2s.
The output will look as below.

ways for speed up MATLAB application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i have a question on speed up application built by MATLAB software, i need to know the affect of using vectorization and parallel computation on speed up the application ? and if there is better method than both previous way in such case ? thanks
The first thing you need to do when your MATLAB code runs too slow is to run it in the profiler. In recent versions of MATLAB, this can by done by pressing the "Run and Time" button on the main toolbar. This way, you will now which functions and which lines in these function take up the most time. Once you know this, you may do one of the following, depending on your circumstances and the nature of the particular piece of code:
Think if your algorithm is the most optimal one in terms of O() complexity.
Try turning loops into vector operations. The efficacy of this has declined in recent versions of MATLAB because of improvements in how loops are executed.
If you have a multi-core CPU try using the parallel computing toolbox. If your code parallelizes well, you will get a sped up nearly equal to the number of cores.
If you have an nVidia GPU try using the GPU support. You can get a speed-up by a factor of 10 or more with some problems, but not all problems are amicable to this sort of optimization.
If everything else fails, you may outsource the slowest piece of your code to a low level language like C. See here for how to do this. You could then use low-level profiling tools like Intel vTune to get the absolute maximum speed from the low-level code.
If it is still too slow, you may need to buy an FPGA. See here for a brief tutorial.