how to change Function value intiialization? mine is start with 0. i want start with -1

8 ビュー (過去 30 日間)
f = zeros(1,length(t));

採用された回答

John D'Errico
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 件)

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan 2017 年 12 月 10 日
f = zeros(1,length(t)) - 1;

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by