How can I subtract this matrix in this function?
古いコメントを表示
Hello, I'm having some difficulty with implementing a matrix into a particular function I'm using in the code below:
% function dy = Verhulst_KT(t,y)
dy = zeros(1,1);
dy(1) = r*y(:)*(1-y(1)/(300 + 100*sin(pi/6*t-pi/2))-H );
end
Where H is defined by:
for i = 1:61
s = ones(1,60);
s(i) = rem(T(i),mod);
if s(i) < 10 && s(i) > 3
H(i) = 160;
else
H(i) = 0;
end
end
I've tried referring to individual positions in H within the function and to the whole matrix itself but either a single element is read which is not what I'm after or I get the error "In an assignment A(:) = B, the number of elements in A and B must be the same." I was just hoping I could get some quick assistance in what is hopefully a fairly simple problem. Thank you in advance.
EDIT: I'm using ode45 to solve the equation itself, T is a row matrix from 0:60 and r is a constant. In hindsight, I probably could've done with pasting in the whole code but I wanted to avoid unnecessary content, apologies for any confusion caused.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!