[idx,c,sumd,d] = kmedoids(dat,nclust,'Distance',@dtw);
But I end up with the following errors. I have done this before... with the exact same code. Does anyone know what I could be doing wrong?
Error using pdist (line 371) Error evaluating distance function 'dtw'. Error in internal.stats.kmedoidsDistObj/pdist (line 65) out = pdist(X,distObj.distance); Error in kmedoids>precalcDistance (line 575) distVec = distObj.pdist(X); Error in kmedoids>loopBody (line 546) xDist = precalcDistance(X,distObj); Error in kmedoids (line 362) oneRun = loopBody(algorithm,initialize,X,k,distObj,pneighbors,numsamples,options,display,usePool,onlinePhase); Error in dtwclassifier (line 9) [idx,c,sumd,d] = kmedoids(dat,nclust,'Distance',@dtw); Caused by: Error using dtw (line 115) The number of rows between X and Y must be equal when X and Y are matrices
Would it be correct to compute my own distance matrix using DTW, and perform K-Means clustering on that?
function D2 = distfun(ZI,ZJ) % calculation of distance ...
data = rand(161,20); [idx,c,sumd,d] = kmedoids(data,10,'Distance',@dtwf); function dist = dtwf(x,y) % n = numel(x); m2 = size(y,1); dist = zeros(m2,1); for i=1:m2 dist(i) = dtw(x,y(i,:)); end end
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.