MATLAB: How to change Function value intiialization? mine is start with 0. i want start with -1 f = zeros(1length(t)); f = zeros(1,length(t)); Best Answer The trivial answer is to subtract one from the array of zeros.Or, replace the zeros with -1. Thusf(:) = -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. Related SolutionsMATLAB: Create vector that consists only of zeroes err = zeros(size(data13,1), 1) ;but don't call it "error" as it is the name of a function. MATLAB: Can i use 2 push buttons to start and stop this code of mine Get rid of the "clear all" and "close all". Related QuestionMatlab zeros function problemZero paddingFmincon Gradients not Matching with MineChange columns in array to zeros and assign to another vectorHow to Generate 5 Sine-waves each at 72° apart but every wave starting at 0.Replacing n random zeros in a matrix with a specific nonzero value
Best Answer