In case it is helpful, here are all my Matlab videos in a single playlist ru-vid.com/group/PLxdnSsBqCrrEU0dLSrTcl0-w9cVYKMTaF. You can support this channel via Patreon at www.patreon.com/christopherwlum or by clicking the 'THANKS' button underneath the video. Please let me know what you think in the comments. Thanks for watching!
for those who are using R2021b some tweaks are to be made as described below 11:42 you will see an extra variable (probably named ans) in your workspace once 'sim('PendulumModel.slx')' command is executed. 13:55 Now after that when you create an outport(yout) in simulink and run the code, you wont see any other variable getting added to your workspace. that is because the 'yout' variable will be created under the variable that was previously generated(probably named ans). Due to this you wont get the output you are expecting, to get the appropriate output just change code line, at 15:17 thetasignal = yout.getElement('theta'); to thetasingal = ans.yout.getElement('theta'); also to check the yout variable in command prompt , 14:05 type 'ans.yout'+enter 19:31 to get signal dimensions go to debug ------> information overlays ------->signals------->signal dimensions 23:58 'simX' & 30:38 'logsout' is similar variable to 'yout'. Change the code in similar way.
AE501: This video had exactly what I needed to output data from Simulink. I also never knew you could run a Simulink model from a Matlab script! Knowing that in undergrad would've have helped a lot. Thanks again for a great Simulink reference.
Many thanks for your work! If I would find this tutorial earlier it would have saved me tons of time spent figuring things out myself. Still, this was extremely helpful, thanks to concise and clear way that you present information. Looking forward to learn more from your excellent tutorials.
Hi, Thanks for the kind words, I'm glad you enjoyed the video. If you find these videos helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum or via the 'Thanks' button underneath the video. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. Thanks for watching! -Chris
Hi, Thanks for the kind words, I'm glad you enjoyed the video. If the find the these videos to be helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. Thanks for watching! -Chris
Hi, Thanks for the kind words, I'm glad you enjoyed the video. If you find these videos helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. Thanks for watching! -Chris
Hi Ashish, Thanks for the kind words, I'm glad you enjoyed the video. If you find these videos helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum or via the 'Thanks' button underneath the video. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. Thanks for watching! -Chris
I'm glad you enjoyed it. I've got several other videos in this series on the channel (and more coming in the very near future). Please let me know what you think of the other videos, thanks for watching!
Hi Michele, Thanks for the kind words, I'm glad you enjoyed the video. If you find these videos helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. Thanks for watching! -Chris
Hi Samer, Thanks for the kind words, I'm glad you enjoyed the video. If you find these videos helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum or via the 'Thanks' button underneath the video. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. Thanks for watching! -Chris
AE501. Great Video. I had actually never really used Simulink and I was thinking whether this was possible during the last video. I think you did a great job describing how to utilize it. Thanks for the vid!
Thanks for the kind words, I'm glad you enjoyed the video. If the find the these videos to be helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. Thanks for watching!
I'm glad it was helpful. There are other similar videos on the channel please feel free to check them out and let me know what you think in the comments. Thanks for watching
Hi, Thanks for the kind words, I'm glad you enjoyed the video. If you find these videos helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum or via the 'Thanks' button underneath the video. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. I can also answer any questions, provide code, notes, downloads, etc. on Patreon. Thanks for watching! -Chris
AE 501. Great refresher video. I used Simulink a lot in my aero undergrad but I haven't used it quite as much post grad so this was super helpful shaking the rustiness of the bones. I was curious though how you were able to get the labels on the scope plots, I didn't see any options to label the title/give an x or ylabel. You could probably output the data to matlab and then plot from there (spoilers for the next video ha!) but I just wanted to know if the use of scope was limited or not. Thanks again!
Although at 15:27 he shows you how to extract the time signal from the structure (which is nice to learn how to extract any signal from a structure), every simulation will always give you the time vector for the whole thing in the variable *tout* , which you don't need to define because the model will output it by default for you. That *t* that he defined is already *tout* if you wanted to use it. You can see in the variables section that they will both end having the same dimensions, a vector of 903 elements.
AE501: Very thorough tutorial. Provides instruction on multiple different ways to get data from Simulink to Matlab and vis-à-vis. I think I prefer your 45 minute videos to the 70+ minute videos, especially for foreign concepts.
Thank you Chris, it was really a nice video. Very well explained. I would like to know few more things about the interaction between matlab script and Simulink. What I want to do is, I want to execute an optimization code which measures the Simulink output continuously over time and under certain conditions it optimizes the input signal and applies the modified input to the simulink while it is still running. Is it possible to do that? In case it is possible I would like to request you to make a video on this. Thank you.
Hi, Thanks for reaching out. If you have questions or would like to request a video, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum or via the 'Thanks' button underneath the video. I'd love to have you as a Patron as I'm able to talk/interact personally with Patrons. Thanks for watching! -Chris
AE501: Great intro to getting matlab to talk to simulink. I was using R2020b and had some trouble getting "yout" to work correctly like your video. Had to go to model settings -> data import/export -> "uncheck" single simulation output and all worked perfectly. I guess mathworks must have modified that between 2016b and now.
Andrew, thanks for pointing this out, this is very helpful for users with R2020b. There were indeed some changes made between Matlab versions. As such, be careful in future demos and you may need to make small tweaks.
You are the best teacher that I have ever found for Control Theory, I wish I knew you when I was taking my control systems course at university and yeah... you just got a new subscriber. ;)
Thanks for the kind words. I've got several other videos on Matlab at ru-vid.com/group/PLxdnSsBqCrrEU0dLSrTcl0-w9cVYKMTaF, please feel free to check them out. Thanks for watching!
AE501- The level of detail and why the methods are done each way is very helpful. Taking the viewer from novice to beginner quickly. More useful tools in the toolbox for Simulink! Thank you Chris!
I'm glad it was helpful. There are other Simulink videos on the channel. Please feel free to check them out. I'd love to hear from you in the comments on a future video. Thanks for watching!
Thank you for the tutorial! Can i extract the data from simulink, for example in this tutorial theta and theta dot, use them as inputs for a matlab script and feed the output back to the simulink model. My question basically is: is it possible to use the "x" state data while its being updated in the array at every time step?
Hi, Thanks for reaching out. If you have questions or would like to request a video, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum or via the 'Thanks' button underneath the video. I'd love to have you as a Patron as I'm able to talk/interact personally with Patrons. Thanks for watching! -Chris
can any one please help on this messages No appropriate method, property, or field 'values' for class 'Simulink.SimulationData.Signal'. Error in Matlabscriptwithsimulinkmodel (line 24) theta = thetaSignal.values.Data;
Dear sir , Hello, First of all thank you for your videos I hope you can help me with my issue, i am working with matlab simulink and matlab script and i need to bring some data from work space to simulink model and for the script code i must run the model first because there is signals i need it for the code to work correctly so i need to run the model and simulink in the same time (sorry i know its confusing). My issue is when i use the from workspace block i get the following error Error using FAULTMMC (line 4) Invalid variable specified as workspace input in 'MMCV/From Workspace'. The variable is either a matrix or is a Simulink.SimulationData.Dataset object with an element containing matrix data. The matrix data must be a real, double, have two dimensions, and at least two columns. The first column must contain time values and the remaining columns the data values. Matrix values cannot be Inf or NaN
Do you have video show Matlab/Simulink co-simulation. For example: If the Matlab runs a scenario from 0 to 10 sec at time-step t0. At each t0 Matlab-time-step, Matlab generates data D that needs to be sent in the Simulink model. The Simulink model is also runs from 0 to 10 sec, but 1) it runs at t1 Simulink-time-step, 2) at each t0 time-interval it gets D data from Matlab, 3) it outputs data, called outData (initial outData=0) at each t2 time-interval. So both Matlab code and Simulink model run together to finish from 0 to 10 seconds. In addition, the Simulink model needs to use all the D data from beginning to the latest one in order to run at each t1 Simulink-time-step.
This is so informative, Going from timeseries and a structural timeseries. I am assuming the array mode has same or different extraction rules as well. I have a brushless DC 3 phase model. I have broken it down into components. Trying to get data parameters from a real motor for the mask block. Motor and control board -- Real Hardware -- How do I step this hardware to get a system Identification from this hardware, building a transfer function similar to your DE pend equation by creating and testing Matlab script files and extracting data from the Simulink model and the real hardware model from via stepping and putting a scope on the output of the model possible creating a bode plot. Maybe using a network analyzer to capture magnitude and phase. Signal source in and Capture wave forms out. Motor Drive hardware is controlled via microcontroller. Sending commands sends the motor to position. I am thinking we would bypass the microcontroller and step after the micro giving us the analog real time version of the model. Mto avoid
Hi Phillip, Thanks for the kind words, I'm glad you enjoyed the video. If you find these videos helpful, I hope you'll consider supporting the channel via Patreon at www.patreon.com/christopherwlum or via the 'Thanks' button underneath the video. Given your interest in this topic, I'd love to have you a as a Patron as I'm able to talk/interact personally with all Patrons. I can also answer any questions, provide code, notes, downloads, etc. on Patreon. Thanks for watching! -Chris
I'm glad it was helpful. There are several related videos on the channel. Please feel free to check them out and I would love to hear what you think in the comments. Thanks for watching!
Thank you for the detailed video Dr. Lum. I came to realise many new things that MATLAB could do. However, I would like to know that is there any way to run the system with a vector type input.
Yes, signals can be vectors or matrices. Check out my video at ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Cvu2zWk3gYw.html for info on how to do this. Thanks for watching.
AE501: Very helpful video, I am re-watching it to try and understand the relationship between the out command an the variable yout. After adding the element to Simulink and trying to run in Matlab, I am still getting an error for the variable yout, which was not added to the workspace. Any help would be apprecieated. -Natalia Ermolaeva
Note that the steps outlined in the video are for an older version of Matlab. I have updated code in the description of the video. Try this out and let me know if things still aren't working.
HI, If I have an EOM as 4mu''+15cu'+3ku=12cz' where m=mass, c=damping & k=stiffness, u =response, and z=input displacement if z=Zsin(omg*t), Z=amplitude of input, then how I will give input to simulink?