I have a 3 column matrix, xyK, that contains x and y coordinates and the value of curvature at each of those coordinates. I'm trying to find the peak values of curvature and the coordinates they occur at and put that information into another 3 column matrix.
function [L,R,C,xyK] = curvature(xy) % Radius of curvature and curvature vector for 2D or 3D curve % [L,R,C] = curvature(X) % X: 2 or 3 column array of x, y (and possibly z) coordiates % L: Cumulative arc length % R: Radius of curvature % C: Curvature vector N = size(xy,1); dims = size(xy,2); if dims == 2 xy = [xy,zeros(N,1)]; % Do all calculations in 3D end L = zeros(N,1); R = NaN(N,1); C = NaN(N,3); xyK = zeros(N,3); for i = 2:N-1 [R(i),~,C(i,:)] = circumcenter(xy(i,:)',xy(i-1,:)',xy(i+1,:)'); L(i) = L(i-1)+norm(xy(i,:)-xy(i-1,:)); end i = N; L(i) = L(i-1)+norm(xy(i,:)-xy(i-1,:)); if dims == 2 C = C(:,1:2); end xyK = [xy(:,1:2), C(:,2)];
ANSWER
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
Try This:
[~,locs] = findpeaks(xyK(:,3)); sol = xyK(locs,:);
Comments
Post a Comment