a = load('ra1.dat'); x = a(:,1); y = a(:,2); y_mov_average = filter(ones(1,50)/50,1,y); plot(x,y); hold on dy = diff(y)./diff(x); dy_mov_average = filter(ones(1,10)/10,1,dy); plot(x(2:end),dy_mov_average); PEAKSID = findpeaks(dy_mov_average); ID = class(PEAKSID); PEAKIDCAL = double(max(PEAKSID)); VALUE = find(y==PEAKIDCAL); xaty = x(VALUE);A portion of the ra1.dat is pasted below. Its a force distance plot by atomic force microscope.817 -1.602783815.8824 -1.604004814.7649 -1.603394813.6473 -1.602783812.5298 -1.602478811.4122 -1.602173810.2946 -1.601563809.1771 -1.601868808.0595 -1.602478806.942 -1.601868805.8244 -1.602478804.7068 -1.602478803.5893 -1.602173802.4717 -1.602478801.3542 -1.603088800.2366 -1.603699799.1191 -1.601868798.0015 -1.602783796.8839 -1.603088795.7664 -1.603394794.6488 -1.604004793.5313 -1.603088792.4137 -1.604309791.2961 -1.604004790.1786 -1.603394789.061 -1.604614787.9435 -1.604004786.8259 -1.604919785.7084 -1.604004784.5908 -1.603394783.4732 -1.604309782.3557 -1.604614781.2381 -1.604614780.1205 -1.604004779.003 -1.60553777.8854 -1.604309776.7679 -1.604309775.6503 -1.604614774.5328 -1.604004773.4152 -1.604004772.2977 -1.604614771.1801 -1.604919770.0625 -1.604614768.9449 -1.60553767.8274 -1.604309766.7098 -1.605225765.5923 -1.606445764.4747 -1.60675763.3572 -1.60614762.2396 -1.60614761.1221 -1.60553760.0045 -1.604614758.887 -1.603394757.7694 -1.603699756.6518 -1.604919755.5342 -1.60553754.4167 -1.60553753.2991 -1.604614752.1816 -1.604919751.064 -1.605835749.9465 -1.60553748.8289 -1.60553747.7114 -1.60553746.5938 -1.606445745.4763 -1.605835744.3587 -1.60614743.2411 -1.604919742.1235 -1.605835741.006 -1.60553739.8884 -1.60553738.7709 -1.60675737.6533 -1.607056736.5358 -1.607666735.4182 -1.607666734.3007 -1.607056733.1831 -1.607666732.0656 -1.606445730.948 -1.607971729.8304 -1.607666728.7128 -1.607056727.5953 -1.607361726.4777 -1.608276725.3602 -1.607056724.2426 -1.60614723.1251 -1.608582722.0075 -1.608887720.89 -1.609802719.7724 -1.609192718.6548 -1.608887717.5373 -1.608276716.4197 -1.608582715.3021 -1.609802714.1846 -1.608276713.067 -1.608276711.9495 -1.609802710.8319 -1.609497709.7144 -1.609497708.5968 -1.609802707.4792 -1.610107706.3617 -1.608276705.2441 -1.608276704.1266 -1.607666703.009 -1.608887701.8914 -1.608276700.7739 -1.608582699.6563 -1.608887698.5388 -1.608582697.4212 -1.609802696.3036 -1.609192695.1861 -1.610107694.0685 -1.609802692.951 -1.610107691.8334 -1.609192690.7159 -1.609192689.5983 -1.610107688.4807 -1.609802687.3632 -1.609802686.2456 -1.611023685.1281 -1.609802684.0105 -1.610718682.8929 -1.610107681.7754 -1.610413680.6578 -1.609802679.5403 -1.611633678.4227 -1.611328677.3052 -1.610718676.1876 -1.610718675.07 -1.611023673.9525 -1.611328672.8349 -1.611328671.7173 -1.613159670.5998 -1.612244669.4822 -1.612244668.3647 -1.612244667.2471 -1.611633666.1296 -1.611023665.012 -1.611938663.8944 -1.612854662.7769 -1.613464661.6593 -1.613159660.5417 -1.612854659.4242 -1.61377658.3066 -1.61377657.1891 -1.61377656.0715 -1.613464654.954 -1.613464653.8364 -1.611328652.7189 -1.611938651.6013 -1.611938650.4837 -1.611633649.3661 -1.612549648.2486 -1.61438647.131 -1.612854646.0135 -1.612549644.8959 -1.613159643.7784 -1.614075642.6608 -1.613464641.5433 -1.612854640.4257 -1.613464639.3082 -1.613464638.1906 -1.612549637.073 -1.612244635.9554 -1.613464634.8379 -1.613159633.7203 -1.613464632.6028 -1.61377631.4852 -1.614075630.3677 -1.61377629.2501 -1.614075628.1326 -1.61438627.015 -1.615295625.8975 -1.615906624.7799 -1.615906623.6623 -1.61499622.5447 -1.616211621.4272 -1.61499620.3096 -1.61499619.1921 -1.616211618.0745 -1.615295616.957 -1.615601615.8394 -1.616211614.7219 -1.615601613.6043 -1.61499612.4868 -1.615601611.3692 -1.617432610.2516 -1.615906609.134 -1.615601608.0165 -1.617126606.8989 -1.617737605.7814 -1.617126604.6638 -1.616821603.5463 -1.617432602.4287 -1.617432601.3112 -1.617737600.1936 -1.618347599.076 -1.618347597.9585 -1.618347596.8409 -1.618958595.7233 -1.618347594.6058 -1.618958593.4882 -1.618042592.3707 -1.618652591.2531 -1.618652590.1356 -1.618652589.018 -1.618958587.9005 -1.618958586.7829 -1.618958585.6653 -1.619873584.5478 -1.620483
MATLAB: I am plotting the derivative of a curve. Getting the y value for maximum peak height of the biggest peak. But when I try to get the x value corresponding to that y value its not giving me any value. Following is the code. Any help would be apprecia
value
Related Question
- How to convert a char into double
- How to open a sequence of files using textscan? The files are named ra1001 to ra1150. Thanks in adavance. Any help would be much appreciated.
- InterX issues. Showing intersection when there is none.
- Do I receive ‘Error using ==> avifile.addframe>ValidateFrame’ when adding a frame to the avi file
- I have to get the x values for peaks occuring in the plot? What will be the code for that
Best Answer