第6章 M文件和函数句柄.ppt

第6章 M文件和函数句柄.ppt

A=pi/2; Heig=@sin; d=feval(Heig,A) d = 1 de=eval(Heig,A) ??? Error using == eval Function eval not defined for variables of class function_handle. 作 业 请分别写出用for和while循环语句计算下式的程序,此外,请写出一种避免循环的计算程序 第6章 M文件和程序控制 6.1 Matlab控制流 6.2 脚本文件和函数文件 6.3 Matlab的函数类别 6.4 函数句柄 6.1 Matlab控制流 for循环 while循环 if-else-end结构 switch-case结构 6.1.1 For循环结构 for n = array {commands} end for n=1:10 x(n)=sin(n*pi/10); end x x = Columns 1 through 6 0.3090 0.5868 0.8090 0.9511 1.0000 0.9511 0.8090 Columns 8 through 10 0.5868 0.3090 0.0000 for循环不能用for循环内重新赋值循环变量n来终止 ; 在for循环内接受任何有效的M

文档评论(0)

1亿VIP精品文档

相关文档