matlab构造矩阵函数(matlab构造分段函数)
2023-07-31
互联网 2023-07-31 11:20:28
(资料图片)
1、应该这样写:function main()clc;x = 12;fx = ceshi_fun(x)function fx = ceshi_fun(x)if nargin < 1 x = 1;endif x ~= 10 fx = x*sqrt(x+sqrt(x));else fx = cos(x+1)+sqrt(x^2+1);end结果:fx = 47.1893。
本文到此分享完毕,希望对大家有所帮助。