Octave教程一:基本操作

Octave教程一:基本操作

我使用的是Octave4.2.0版本,运行命令行程序。

代码块

标准octave代码:

GNU Octave, version 4.2.1
Copyright (C) 2017 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-w64-mingw32".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> 5+6
ans =  11
octave:2> 2 ^3
ans =  8
octave:3> 1 == 2   %false
ans = 0
octave:4> 1 ~= 2
ans = 1
octave:5> 1 && 0
ans = 0
octave:6> 1 && 4
ans = 1
octave:7> 1 || 0
ans = 1
octave:8> xor (1,0)
ans = 1
octave:9> PS1('>> ');
>>
>>
>> a = 3
a =  3
>> a = 3;
>> a
a =  3
>> b = 'hello';
>> b
b = hello
>> c = (4>=2);
>> c
c = 1
>>
>> a = pi;
>> a
a =  3.1416
>> disp(a);
 3.1416
>> disp(sprintf('2 decimals: %0.2f',a))
2 decimals: 3.14
>> disp(sprintf('2 decimals: %0.6f',a))
2 decimals: 3.141593
>> a
a =  3.1416
>> format long
>> a
a =  3.14159265358979
>> format short
>> a
a =  3.1416
>>
>>
>> A = [1 2;3 4;5 6]
A =

   1   2
   3   4
   5   6

>> A = [1 2;
> 3 
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值