11 views (last 30 days)

Image Analyst
on 8 Jul 2020

Exactly what is an "elliptical line"? That's a new one on me. I know lines, and I know ellipses, but not an elliptical line. What is it?

Anyway, if you have "some data" on a line, you can get the slope of a line fitted through your "some data" from the polyfit() function.

coefficients = polyfit(x, y, 1);

The slope of the line fitted through the x and y points is

slope = coefficients(1);

Image Analyst
on 9 Jul 2020

No, because I didn't know what you meant. So you have an ellipse and you want the slope of a line that's tangent to the ellipse at each points. What I'd probably do is Use John and James code. Untested code

slopeInfo = zeros(length(x), 3); % Col1 = x, col2 = y, col3 = slope

for k = 1 : length(x) % for every (x,y) point on the ellipse (almost)...

slopeInfo(k, 1) = x(k); % Assign x to column 1.

slopeInfo(k, 2) = y(k); % Assign y to column 2.

slopeInfo(k, 3) = -4 * x(k) / y(k); % Assign slope to column 3.

end

Opportunities for recent engineering grads.

Apply Today
## 4 Comments

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_930215

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_930215

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_931112

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_931112

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_931181

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_931181

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_931205

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/561965-does-anyone-know-how-to-calculate-the-slope-of-elliptical-line-by-using-the-matlab#comment_931205

Sign in to comment.