Calculating Angle Between Two Vectors / Three Points
조회 수: 7 (최근 30일)
이전 댓글 표시
So I have some raw data from an experiment (plotted below) which exhibits hysteresis behaviour. I would like to locate and highlight the points on the plot where there are sharp changes in direction.
So far I have tried three things: converting points to vectors and using cross/dot product to calculate the angle between two vectors; calculating the radius of curvature along three consecutive data points and lastly going back to basics and using the Cosine rule in groups of three data points. In each case I have created a cruder plot of the raw data using the RPD algoritm (see below) and attempted to identify the significant changes in direction by assigning a minimum curvature/angle etc.
I'm aware there are some versions of this topic already covered but I still seem to be missing something.
In each of these attempts the outputted angles are not what is expected i.e. angles that appear to be at ~ 90 deg on the plot are output as close to 2-3 deg etc. and hence lots of the flatter sections of the plots are picked up by the markers.
The desired points that I am aiming to pick up are shown below, although I understand a few others may be picked up in the process this is ok, as I'm mostly aiming to eliminate the markers currently picked up along the flat section of the plot.
I would appreciate any assistance anyone can offer, I've included my raw data, m files for angle calcs and for smoothing the data if anyone would like to look.
RAW DATA
After RPD Algorithm is Applied
Example of Markers Highlighted (from 'AnglesUsingVectors' Script)
Desired Marker Locations
댓글 수: 0
채택된 답변
Teja Muppirala
2019년 3월 26일
The units on the axes are very different. Displacement is around +/- 3 while shear is around +/- 80, so the calculated angles from the data will not match at all what they appear to be on the graph. You may want to scale the variables to be roughly equal in magnitude first (for example by using ZSCORE or whatever) and then redo the angle calculation and you may get more reasonable values.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!