how to change Function value intiialization? mine is start with 0. i want start with -1
1 次查看(过去 30 天)
显示 更早的评论
f = zeros(1,length(t));
0 个评论
采纳的回答
John D'Errico
2017-12-10
The trivial answer is to subtract one from the array of zeros.
Or, replace the zeros with -1. Thus
f(:) = -1;
Or, learn to use the function ones. It works just like zeros. Multiply by -1.
Or, learn to use repmat. Thus repmat(-1,[1,nt]).
Or many other solutions.
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!