最近一直在查找矩阵函数之类的问题,上午正好有机会和大家分享一下.
机器学习- Matlab 编程常用命令速览
--总结自Ng-ML-class Octave/Matlab Tutorial Coursera
magic(N) is an N-by-N matrix constructed from the integers
1 through N^2 with equal row, column, and diagonal sums.
Produces valid magic squares for all N > 0 except N = 2.
flipud(X) returns X with columns preserved and rows flipped
in the up/down direction. For example,
X = 1 4 becomes 3 6
2 5 2 5
3 6 1 4
g green o circle : dotted
r red x x-mark -. dashdot
c cyan + plus -- dashed
m magenta * star (none) no line
y yellow s square
k black d diamond
w white v triangle (down)
^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
h hexagram
>> plot(t,y1)
>> subplot(1,2,2)
>> plot(t,y2)
>> plot(t, y1)
>> figure(2)
>> plot(t,y2)
exactly 3 columns. Each row is interpreted as a color, with the
first element specifying the intensity of red light, the second
green, and the third blue. Color intensity can be specified on the
interval 0.0 to 1.0.
v(i) = 2 ^i;
end;
>> v
v =
2
4
8
16
32
64
128
256
512
1024
for i = indices,
disp(i)
end;
v(i) = 100;
i = i+1;
end;
>> v
v =
100
100
100
100
100
64
128
256
512
1024
>> i = 1;
>> while true,
v(i) = 999;
i = i + 1;
if i == 6,
break;
end;
end;
>> exit
v =
999
999
999
999
999
64
128
256
512
1024
v =
2
999
999
999
999
64
128
256
512
1024
>> if v(1) == 1,
disp('The value is one');
elseif v(1) == 2,
disp('The value is two');
else
disp('The value is not one or two.');
end;
The value is two
闷热的天,蝉儿耐不住寂寞地不停在鸣叫,我孤单一人,寂静的身旁没有一个知音,想疯狂地听摇滚乐,听歇斯底里的歌声,那只为逃避无人的世界里那浓烈的孤单气息。一个人是清冷,两个人便是精彩,于是,莫名的冲动让我格外想念旧日的好友,怀念过去的日子,尽管不够现实的遐想追回不了曾经一切,但却希望思绪可以飞扬于闭上双目后的世界中,印有微笑,印有舞动的身姿,翩翩起舞……
ans =
25
x1 =
25
x2 =
125
>> j = costFunctionJ(X, y, theta)
j =
0
theta =
0
0
>> j = costFunctionJ(X, y, theta)
j =
2.3333
文章结束给大家分享下程序员的一些笑话语录:
大家喝的是啤酒,这时你入座了。
你给自己倒了杯可乐,这叫低配置。
你给自已倒了杯啤酒,这叫标准配置。
你给自己倒了杯茶水,这茶的颜色还跟啤酒一样,这叫木马。
你给自己倒了杯可乐,还滴了几滴醋,不仅颜色跟啤酒一样,而且不冒热气还有泡泡,这叫超级木马。
你的同事给你倒了杯白酒,这叫推荐配置。
菜过三巡,你就不跟他们客气了。
你向对面的人敬酒,这叫p2p。
你向对面的人敬酒,他回敬你,你又再敬他……,这叫tcp。
你向一桌人挨个敬酒,这叫令牌环。
你说只要是兄弟就干了这杯,这叫广播。
有一个人过来向这桌敬酒,你说不行你先过了我这关,这叫防火墙。
你的小弟们过来敬你酒,这叫一对多。
你是boss,所有人过来敬你酒,这叫服务器。
酒是一样的,可是喝酒的人是不同的。
你越喝脸越红,这叫频繁分配释放资源。
你越喝脸越白,这叫资源不释放。
你已经醉了,却说我还能喝,叫做资源额度不足。
你明明能喝,却说我已经醉了,叫做资源保留。
喝酒喝到最后的结果都一样
你突然跑向厕所,这叫捕获异常。
你在厕所吐了,反而觉得状态不错,这叫清空内存。
你在台面上吐了,觉得很惭愧,这叫程序异常。
你在boss面前吐了,觉得很害怕,这叫系统崩溃。
你吐到了boss身上,只能索性晕倒了,这叫硬件休克。
---------------------------------
原创文章 By
矩阵和函数
---------------------------------