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!