MATLAB: What can I use as a Plus or Minus sign opperations In this equation I can't figure out how to make the + into a plus or minus sign to get both answers other than doing it twice with s1 and s2 instead of s. s=(-800/(2*.1))+(sqrt(((800/(.1*2))^2)-(1/(.1*.000001)))); Best Answer s=(-800/(2*.1))+[1 -1]*(sqrt(((800/(.1*2))^2)-(1/(.1*.000001)))) Related SolutionsMATLAB: Diagonal matrices with spdiags s=0.12;N_r=30;r=linspace(0,1,N_r)';dr=r(2);r_plus=r+0.5*dr;r_minus=r-0.5*dr;a_plus=s*r_plus(1:end-1).^2;a_minus=s*r_minus(1:end-1).^2;a=-(r.^2+s*(r_plus.^2+r_minus.^2));D=[[a_minus(:);0], a(:), [0;a_plus(:)]]; %<---changed B=spdiags(D,-1:1,N_r,N_r); %<--changedB(1,1)=-1;B(1,2)=1;B(N_r,N_r-1)=s*(r_plus(N_r)^2+r_minus(N_r)^2); MATLAB: “plus/minus” sign operator It depends what you want to do with it.M = [1 1 1; 1 1 -1; 1 -1 1; 1 -1 -1; -1 1 1; -1 1 -1; -1 -1 1; -1 -1 -1];Out = (M * Row')' ;Each row of Out is what you want.You might want to programatically generate M if you have more columns on your row. Related QuestionHow to do the coding with plus minus sign infront of square rootPlus-minus functionPlus and minus sign for an equationA matrix of stringsError in matrix dimension and using a plus signPlus or minus calculationHow to find a maximum number not considered minus sign
Best Answer