Error: Index exceeds matrix dimensions?
이전 댓글 표시
The data describes a smooth general curve that then juts up in the middle, and then comes back down and continues the first curve. This function attempts to find the area under the abnormal curve in the middle. Matlab says there is an error in this line: Area=Area+((((func(y)-specdata(y))+(func(z)-specdata(z)))/2)*(z-y));
Thanks in advance
function [ Area ] = Area( func, freq, specdata)
%UNTITLED2 Uses the input function as well as the input data to find the
%area under the spectral lines. This is done using many small trapezoids in
%between each consecutive set of points, finding the values according to the
%function and using the data. The area function is ((a+b)/2)*h.
Area=0;
j=1;
r=length(freq);
while j<r
y=freq(j);
z=freq(j+1);
Area=Area+((((func(y)-specdata(y))+(func(z)-specdata(z)))/2)*(z-y));
j=j+1;
end
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!