结构化程式和自定义函数

Script
1.注解 %
2.%% run section
3.debug---breakpoint
  command window:K>>
4.smart index---快速改排版
5.Flow Control
  if(Rational Operation)
  ~=---不等于
6.loop末尾加end
7.F5---执行,在command window显示运行结果
8.ram(a,b)---a对b取余
9.prod(1:n)---n的阶乘
10.pre-allocating Space to Variables---节省计算时间
11.tic—toc:算运行时间
12.Tips for Script Writing
  ...换行号
  crtl+c---跳出宕机
13.functions
  scripts:NO input/output/in global
  function: / /local workspace
function y=mean(x)
keyword output functionname(input)
comment
code
14.点乘 vector中各元素进行运算
15.  function [a F]=acc(v2,v1,t2,t1,m)
     a=(v2-v1)./(t2-t1);
     F=m.*a;
16.
17.function handle--函数句柄---pointer(指向)
  f=@(x) exp(-2*x);
  x=0:0.1:2;
  plot(x,f(x));

转载于:https://www.cnblogs.com/SUMaywlx/p/9439921.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值