How to calculate the difference between two Areas?

Hi.
I have two areas.
How can I obtain the difference between these two?
How can I then minimize the difference by translating the second area?
Or even better, how can I display the difference between areas as a funcion of the amont of translation done to the second area?

4 Comments

They look alike (to me). (The waves on the top is a nice touch!)
Code, data, and more information about them would be helpful.
Hi.
They are not. Those curves are obtained from the profiles of a cycloid gear.
One profile is theoretical, one is the real profile. The real profile is slightly shifted (in angle, wich is on the x axis of the area graphs).
White is the real tooth profile, Black the theoretical profile.
I exported the points in excel, then in MatLab.
Basically I have plotted the Angle and Radii, obtained after a quick coordinate conversion of the previously exported points in excel.
I'm hoping that, by obtaining the angle value for which the area difference is minimum, I can align the two gear profiles.
As you can see there is a slight misalignment and if you zoom on the Area graphs you can catch it.
Code and data would be helpful.
Sorry but what do you mean by code and data? :S

Sign in to comment.

Answers (1)

If you just want to align those two profiles using angle values, then I would use findpeaks() on both and look at their differences.
% angle1, angle2 are arrays
[~,peaklocs1] = findpeaks(angle1); % add options such as "MinPeakDistance" and others as necessary
[~,peaklocs2] = findpeaks(angle2);
if peaklocs2(1)>peaklocs1(1)
alignment = peaklocs2(1) - peaklocs1(1)
else
alignment = peaklocs1(1) - peaklocs2(1)
end

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Asked:

on 20 Nov 2019

Edited:

on 20 Nov 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!