全球新资讯:matlab 编写分段函数_matlab构造分段函数
发布时间:2023-05-17 21:05:19
来源:互联网
(资料图片仅供参考)
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。
本文到此分享完毕,希望对大家有所帮助。