📄 mysqrt.m
字号:
function y=mysqrt(x)
%MYSQRT Protected SQRT function.
% MYSQRT(X) returns zero if X<=0 and SQRT(X) otherwise.
%
% Input arguments:
% X - the number to square root (double)
% Output arguments:
% Y - the square root of X, or zero (double)
%
% See also MYPOWER, MYDIVIDE, MYLOG, MYLOG2, MYLOG10
%
% Copyright (C) 2003-2004 Sara Silva (sara@dei.uc.pt)
% This file is part of the GPLAB Toolbox
% fill the cells where x<0 (make them 0):
y=zeros(size(x));
% fill the remaining cells with the result of the square root:
i=find(x>=0);
y(i)=sqrt(x(i));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -