Attempted to access f(97); index out of bounds because numel(f)=96.
古いコメントを表示
I have this equation to solve the P(f). But the problem is that f is a matrix of 1x96 the zred and d18ored are both matrix 82x1. and i need to create a matrix with the dimension 82x96. with the equation p(f). i tried with the "." and without it and the error is the same
f=1:0.2:20;
for i=length(f);
ti=zred';
yi=d18ored;
T=(1/(4*pi*f(i)))*(atan(sum(sin(4*pi*f(i)*ti)))/(sum(cos(4*pi*f(i)*ti))));
P(i+1)=((sum(yi*sin(2*pi*f(i+1).*(ti-T)))).^2)/sum(sin(2*pi*f(i+1).*(ti-T)).^2))+...
((sum(yi*cos(2*pi*f(i+1).*(ti-T)))).^2)/sum(cos(2*pi*f(i+1).*(ti-T)).^2));
end
採用された回答
その他の回答 (1 件)
dpb
2015 年 11 月 7 日
for i=length(f)
The above is simply
i=length(f);
there will be only one iteration performed. Since i==length(f), clearly in
P(i+1)=((sum(yi*sin(2*pi*f(i+1) ...
the expression f(i+1) will be an out of bounds reference to f(length(f)+1). Set the upper limit to length(f)-1 to refer only to inbounds locations.
カテゴリ
ヘルプ センター および File Exchange で Time Series Events についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!