Hello All, i am fairly new to the MATlab program and am tasked with evaluating some data for a school project. I have been able to successfully plot 3 curves that form a step response graph. What i have are 3 arrays containing thousands of values each.
- Torque, Actual Position & Desired Position
The Torque plot increases in steps of 100 up to 1600. What i need to do is whenever the data in the torque array changes by an absolute value of more than 99, set a flag and go forward 250 data points and analyze how close Actual Position and Desired Position are at those points. However i'm having trouble trying to understand what approach would be best. Any help is appreciated, thanks.
No products are associated with this question.
You can use the UNIQUE function to find when the torque values change, (assuming they only stay the same or increase from one point to the next?)
[~,I] = unique(Torque,'first');
actPos(I+250) - desPos(I+250);
What are the ~ & I values representing? Sorry i'm still a bit new to the language, and can you specify by how much of a torque value change to look for?
This function will work for one of my step response areas, however i have some files that have numerous torque ramps in different intervals at different sections. Is there a way to set the unique function to search for a change in the value, and go from the beginning of the array to the end?
For Instance, the vector will look something like this:
[ 0 100 0 200 0 300 0 400 0 25 0 50 0 75 0 100 0 125 0 150 0 75 ... ] etc...
With this type of data the unique function searches in incremental order and will give me an output of something like this:
[10 12 14 16 2 18 20 22 4 6 8]
I would need it to search in order from beginning to last on change to have an output of:
[ 2 4 6 8 10 12 14 16 18 20 22]