matlab中怎么用函数返回值进行计算?

2024-11-23 03:45:52
推荐回答(1个)
回答(1):

在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [sinx,cosx]=myfun_1(x)
sinx=sin(x);
cosx=cos(x);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

返回Matlab输入:
x=0:1:2*pi;
[sx,cs]=myfun_1(x)