matlab - to find maximum point from the graph/plot -
a= [1 2 13 20 10 20 12 1 13 14]
b= [1:10:100]
plot(a,b) want find maximum('a') plot , take corresponding point let 'a3,b3' , store else , remove plot. want subtract 'a3' every point left in 'a' , plot graph. , need again till reaches thresh hold point.
this seems odd request if understand correctly.
%input data = [1 2 13 20 10 20 12 1 13 14]; b = [1:10:100]; %some threshold (which didn't specify lengtha = 4; %initialize storage vector aprime = a; bprime = b; %while vector while (length(aprime) >= lengtha) %new figure figure; %plot vector plot(aprime, bprime) %find index , max value in a' [amax, index] = max(aprime); %find max value in b' bmax = bprime(index); %remove max value vector , subtract off max value aprime = aprime([1:index - 1, index + 1:end]) - amax; bprime = bprime([1:index - 1, index + 1:end]) - bmax; end
Comments
Post a Comment