1.编写test函数

function [o,p,q,r] = test( n )%%%%%%%%%%%%%%%编写function test函数

%%%%%%%%%%%%%%%%%%%%%%test函数变量为n,返回值为o,p,q,r

o= 0;
p=0;
q=6;
r=128;
for i = 1:n
    o = o + i;
    p=p+1;
    q=q.*n
    r=r.^0.2
    

end


2.调用tset函数的main函数

clear all;
clear clc;
[a,b,q,r]= test(10)%%%%%%%%%%%%%%%%%%调用test函数n=10,a,b,q,r四个为n=10的test函数的返回值!



matlab基础:函数FUNCTION编写

相关文章:

  • 2021-12-09
  • 2021-12-22
  • 2021-06-27
  • 2022-01-01
  • 2021-12-22
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-22
  • 2022-02-13
  • 2022-12-23
  • 2021-11-22
  • 2021-12-23
  • 2021-08-30
  • 2021-12-23
相关资源
相似解决方案