Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Matlab Help

Status
Not open for further replies.

Iawia

Member
Hi,

I am trying to use matlab's simulink to simulate a 1/4 car model suspension. I have managed to get a nice response of the chassis and tire position just using static inputs like a speed bump or by using a gradually increasing road frequency with a small amplitude. This type of simulation does not properly simulate real road patterns. I can simulate a 'real' road pattern by changing the input to something known as the inverse fourier transform of the power spectral density of the road.

My Question: How do I import the road_profile matrix that I created in the .m file into Simulink? Each time the simulation increments by one time step, the road_profile matrix must also be incremented as the correct input to the model. I have search extensively online for matlab support but could not find much.

I am cant provide the files as this editor does not recognize .m files. I can send them to you if you email me @ Thomas.muray11@gmail.com. You can run the simulation as it is currently, where the input is the bump generator and see that the response is correct. But this input I need to replace with a random road profiles generated from fourier transforms which is the ISO standard. Any help is appreciated. Thanks.

-t

email to encl.
Simulink model & rough_road.m
 
If you are willing to post the simulink and .m files, could you "zip" them? Does the forum accept .zip? I could take a look, but I don't bother changing emails..
(if zip is not allowed, change the end of the files to something else.. like jpg or something. I can then change it back.)

I can't say I can solve the problem, but I have matlab and I can give it a try.
 
There is 1D 2D 3D lookup tables within Simulink. Load the matrix into that with the simulation time (or "simulation increment") as the input to it.
 
If you are willing to post the simulink and .m files, could you "zip" them? Does the forum accept .zip? I could take a look, but I don't bother changing emails..
(if zip is not allowed, change the end of the files to something else.. like jpg or something. I can then change it back.)

I can't say I can solve the problem, but I have matlab and I can give it a try.

Hi Mister T,

The editor does recognize .zip files. Thx for that.
The Simulink file is standalone, and should run right away and give you a bump response. The 'rough_road_input.m' is also standalone and should run by itself. This file is a function, and will return a matrix that can be indexed. A graph is plotted in the .m file for you to view it. Putting these two together is my issue. I want to remove the speed bump and have this random road as my input which I need to index as the simulation steps.

Thanks for taking a look.

(p.s., all these files must be in the same directory)
 

Attachments

  • Rough_Road_Sim_Input.zip
    24.1 KB · Views: 154
After much ado, I have managed to figure out a solution. In order to index your matrix along with a simulation the sampling time and simulation increments must match.
First create the matrix using a .m file and use the save command as one of the lines of code. This stores a matrix in file form so that it is accessible to matlab. Use the 'from file' function in matlab to import your matrix into Simulink. The matrix that is imported must have a row vector at the top of the matrix with the indexed times for each sample. The Simulink file will run now. horaay! Check out my results for a random road input and chassis and tire response. Super cool.

Thanks to anyone who was helping. Best -t
 

Attachments

  • Road_Funct_Chas_Tire_Resp.png
    Road_Funct_Chas_Tire_Resp.png
    105.1 KB · Views: 188
Looks great! I did not have time to look at what the problem was, but good job getting it to work.
 
Looks great! I did not have time to look at what the problem was, but good job getting it to work.
Thanks Mister T, took me about 7 hours of trial and error and searching matlab documentation to figure this out. I am surprised there is not more info on it.
 
Status
Not open for further replies.

Latest threads

Back
Top