Incorrect extreme values of numerical derivative
2 views (last 30 days)
I get different plots from Matlab and SolidWorks. Can anyone check mye code/help with ideas? :)
Disclaimer: I can not guarantee my work in SolidWorks is correct.
This is part of a kinematic analasys of a mechanism. I am to do a numerical analasys of a point of interest and also simulate the mechanism (in my case in SolidWorks). My pont of interest has one-dimentional movement. I use Matlab to calculate the velocity of my point.
The velocity (in regards to time) is very similar for SolidWorks and Matlab.
The acceleration plot however is what i am struggelig with. The graph has the same shape, but Matlab gives the same extreme values in positive and negative. SolidWorks does not. I expect different values (but i may be incorrect).
This is is the "original" matlab plot (array from kinematic calculations). It is an array of numerical values (from a for-loop). These look very similar,
Then I try to find the acceleration by taking the derivative of the speed-plot (or more accurate: the array).
dydx = gradient(array(:)) ./ gradient(t_span(:));
As you can see, they look very similar, but the extreme values are different.
EDIT: the matlab plots have extreme values: -1202.42418329735, +1202.42418329735.
I use Matlab R2019b
I am a beginner user of Matlab.
In advance, thanks!
(my first post here. Please let me know if I need to change anything)
Juan Sagarduy on 25 Nov 2020
Hi Jörgen It looks like the kinematic motion in MATLAB is somehow idealized. The one from SolidWorks is asymmetric and thus shows a different acceleration. Is the result for MATLAB obtained with an imported CAD model with Simscape Multibody? Br Juan