Simulink Switches & If Statements

Поділитися
Вставка
  • Опубліковано 27 гру 2024

КОМЕНТАРІ • 30

  • @abdouproof6915
    @abdouproof6915 4 роки тому +3

    Idk why you stopped doing tutorials 😕 this is the best Simulink tutorial I’ve seen, so clear for beginners

  • @erickoehler7851
    @erickoehler7851 7 років тому +1

    Thanks for the tutorial, it helped me find my error.

  • @nahlashannan
    @nahlashannan 8 років тому

    very clear and useful video
    Thank you for sharing

  • @oestmoestm1295
    @oestmoestm1295 4 роки тому

    Thank you for the tutorial!
    But the course is no longer available on Udemy :/ would you please provide me the working link?

    • @simulinkinstructor7470
      @simulinkinstructor7470  4 роки тому +1

      I hope you found the tutorial useful. I ran out of time to keep the Udemy course up-to-date, so I unpublished it. Unfortunately, I forgot to update the UA-cam video descriptions at the same time. Thank you for the reminder - I will go ahead and update the description for this video to remove the Udemy link.

    • @oestmoestm1295
      @oestmoestm1295 4 роки тому

      It is of course useful, I wish I had acccess to the course before it get unpublished. I don't know if there is any possibility to get access to the course again.
      Thank you again for the content ;)

  • @invisible-fm6lz
    @invisible-fm6lz 4 роки тому +1

    Hi you saved my job

  • @valerioxu6509
    @valerioxu6509 7 років тому

    Nice tutorial. Thanks so much. I have a question. Say I have to model the states of the machine ,such as idle fault good and slow down .the input is a message from a user interface to select the actual state of the machine and then the output could be the velocity or energy consumption or other parameter. This if logic seems only can do numerical comparison . Could you give me a suggestion?thanks

    • @simulinkinstructor7470
      @simulinkinstructor7470  7 років тому

      Valerio, I'm glad to hear the video was helpful for you. If you have fairly simple logic in each state, then the approach taken in this video should work for you. An if-statement created in the way shown in this video is capable of far more than mere numerical comparison. It is possible to have multiple outputs in the triggered subsystems feeding into multiple merge blocks, so multiple I/O are supported, and you can have sophisticated logic within each triggered subsystem, if you choose to. In your case, however, since you have a number of states and need to transition between states based on conditions and change multiple outputs based on the states, using Stateflow within your Simulink model is probably a better choice for you. You should be able to implement all of the logic that you need to without using Stateflow, but Stateflow will likely make your state-based logic easier to create and (importantly) easier to debug.

    • @valerioxu6509
      @valerioxu6509 7 років тому

      Thanks for the answer. Well my case is actually not that complicate. the idea is that here is a user interface and the user enter the state of the Machine ,say (I,F,G,S which represent the actual state of the machine) and this generate a massage as a input and gives an output such as a fixed number. So it's a SIMO case. It doesn't concern state transition(in my point of view). So I wanted to know is it better to use Switch or if statement. thanks.

    • @valerioxu6509
      @valerioxu6509 7 років тому

      I also wanted to know how to generate this message input

  • @retselisitsoemaphephe8969
    @retselisitsoemaphephe8969 8 років тому

    Thanks for the video, very useful to Simulink beginners

  • @noeliasanchezderojasfernan6497
    @noeliasanchezderojasfernan6497 8 років тому +1

    Thank you sooo much!! You help me with an important job

  • @REDSLibrary
    @REDSLibrary 5 років тому

    Nice and clear explanation

  • @Tetrapak1234
    @Tetrapak1234 6 років тому

    Hi, you helped me a lot :D
    I have one question for you.
    In your video you send your output to scope, but i want to have one exact value as my output and i want to store it in a variable (lets say when time in simulation is 6.2 i want to put lane number into variable x, and x will be constant till the end of simulation, and in this case x will be 1)
    Can you help me and tell me how to do this?

    • @simulinkinstructor7470
      @simulinkinstructor7470  6 років тому +1

      I don't usually give technical advice on my UA-cam videos, but I'll try to help you out with this question. Here's one way to do this, although I haven't actually tried this before typing my reply: feed the output of a discrete clock into a 'compare to constant' block. with a value set equal to or greater than '6.2.' When the simulation time exceeds 6.2 seconds, the output of this block should be a logical '1.' Feed the output of the 'compare to constant' block into the trigger of a triggered subsystem. The trigger should be setup to execute on a rising edge. Feed the current lane number (the variable whose value you want to save at t = 6.2 seconds) as an input into the triggered subsystem, and within the triggered subsystem, connect the input to a 'To Workspace' block, which should be set up to output an array. After running the simulation, the array will be populated with zeros until 6.2 seconds, and then populated with the lane number after that. This isn't going to put a variable with constant value into your workspace, but you could always setup a model callback to execute when the simulation is done. Your callback code could simply take the max of the array. Now, when you run the simulation, the output will be a variable in your Matlab base workspace with a value equal to the lane number at t = 6.2 sec, which I think is what you are wanting. Hope that helps!

    • @Tetrapak1234
      @Tetrapak1234 6 років тому

      Thats exactly what i needed :D , thanks a lot

    • @Tetrapak1234
      @Tetrapak1234 6 років тому

      Thanks a lot :D

  • @sowji__5
    @sowji__5 2 роки тому

    Plz 🙏 upload the all the simulink tutorials sir or else if u possible continue the course from starting sir it is more useful to me u r preaching also good to listen carefully sir now matlab simulink is I needed I searching loat of channels but those are not given a full description to about the vedio sir. Plz 🙏 if u possible Plz upload the the all tutorials sir it is more helpful to me

    • @simulinkinstructor7470
      @simulinkinstructor7470  2 роки тому +1

      Ok, you've convinced me! I saw your comment a couple of months ago but I haven't had time to upload the rest of the course. I am working on getting the rest of the course uploaded now and scheduled. It should all be public on UA-cam in a couple of days' time. I'm glad you found this video useful and hope that the rest of the material is helpful to you as well.

  • @kajalilavya1801
    @kajalilavya1801 4 роки тому

    Thank you!

  • @aminaimen78
    @aminaimen78 4 роки тому

    👍👍

  • @LvtLoshi
    @LvtLoshi 8 років тому +1

    Your voice sounds pretty similar to aftrotechmods

    • @simulinkinstructor7470
      @simulinkinstructor7470  8 років тому +1

      Interesting observation. You're right - his voice does sound rather similar.

    • @QRobotix
      @QRobotix 8 років тому

      Exactly my thought as well

  • @mostafaazizi6625
    @mostafaazizi6625 8 років тому

    good for you!

  • @gulrukh1386
    @gulrukh1386 8 років тому

    I like your very good video, Sir, I have one question, I have one problem in my PID Controller with my Simulink Model, I tried a lot but I failed badly, I want to send my Model at your end and after Tuning send back to me with many thanks.
    I will be very grateful to you and obliged.
    Thanks again.
    Best Regards
    Gul Rukh Khan
    email: grkhan@hec.gov.pk

    • @simulinkinstructor7470
      @simulinkinstructor7470  8 років тому +1

      Gul,
      You will not learn as much if I am modifying your Simulink model for you. However, I’m happy to point you to some good resources and perhaps answer a question or two if you still have any unresolved questions. I would strongly suggest using Simulink’s discrete or continuous PID controller blocks, which have a built-in tuner. Mathworks has excellent documentation on these, which you may review at www.mathworks.com/help/slcontrol/gs/automated-tuning-of-simulink-pid-controller-block.html and at www.mathworks.com/help/simulink/slref/pidcontroller.html. These will even allow you to select the gain and phase margins that you need (I would recommend 6-12dB and 45-60 degrees, depending on the application) as well as the time-domain response (such as % overshoot). You can also view both time and frequency-domain response for the plant, open-loop, and closed-loop transfer functions, so the tuning tool that Matlab offers with their PID blocks is really fantastic. I’ve had good success with using this tool to design gains for a controller for a real-world system that I was working on. Try reading the documentation that I’ve linked to…if you still have a question after that, let me know and I’ll try to help you out.

    • @Sm1tHyBo1
      @Sm1tHyBo1 7 років тому

      Hi there, really enjoyed the video cheers for the help. I am trying to make a Simulink model for a quadcopter moving around a course- I need the drone to realise when its reached a certain point in space, then use a switch to make it go to its next point. Your video was very helpful in showing me the right blocks to use, I am just struggling to put it all together. Could I email you some screenshots for you to look at or ask in further detail? Cheers