3
190
¥ 10.00 ¥39.00 限时秒杀
开通会员,立省1.00元, 立即开通
立即购买

你将收获

学员能够系统掌握MATLAB开发的一般方法和原理。

可以掌握绘图相关技能

掌握数组方面的运算逻辑

适用人群

所有人

课程介绍

MATLAB基础入门课程,系统介绍MATLAB的基础知识。

主要从数组、运算、结构和绘图等几方面进行讲解

简单易懂,轻松入门MATLAB

课程讨论

老师讲得好
老师是个利索人.zszszszszs
老师能发一些课件和练习题吗 smyyl5@nottingham.edu.cn 感谢!
老师讲的很好很细致, 可以麻烦老师发点练习题吗 wyh1109292635@gmail.com 感谢!
求课件15247140829@163.com
求课件!724461879@qq.com
老师,能把课件发我一份吗,邮箱:524690885@qq.com,多谢老师!
老师真的很nice,
很喜欢老师讲可的方式,声音也很好听,讲的也很清晰,推荐!
老师讲的很好,支持一下,好评

同学笔记

  • lolitapanis 2020-08-12 17:50:00

    来源:绘图开关 查看详情

    for 循环变量=开始值:[步长]:终止值

    语句体

    end

     

    for i=1:5

    i

    end

     

    for i=2:4:14

    i

    end

     

    a=5;

    while a<10

    a

    a=a+1;

    end

     

    for i=1:5

    if i==3

    continue

    end

    i

    end

     

    for i=1:5

    if i==3

    break

    end

    i

    end

     

    try

    语句1

    catch

    语句2

    end

     

    a=ones(3,3)

    a(14,:)

     

    det(rand(2,4)) 取行列式

    a=6

    a

    try

    det(rand(2,4))

    catch

    disp(laster)

    end

     

    try

    a(14,:)

    catch

    disp(‘发生错误,具体为:’)

    disp(lasterr)

    end

     

    try

    a(14,:)

    catch

    disp(‘error’)

    disp(lasterr)

    end

     

    新建脚本

    for i=1:100

    i

    end

    ctrl+s保存在默认文件夹下

     

    clear all

     

    创建新文档

    函数

    输出 输入

     

    function [ c ] = myadd( a,b )

    %UNTITLED3 此处显示有关此函数的摘要

    %   此处显示详细说明

    %   c=a+b

        c=a+b

    end

    ctrl+S(区分大小写)

     

    % 注释

     

    myadd(4,6 )

     

    x=1:10

    y=sin(x)

    line(x,y)

     

    x=1:0.01:10

    y=sin(x)

    line(x,y)

     

    F5 运行

    ctrl+R 快速注释

     

    plot函数

    plot(x)

    plot(x,y)

    plot(x1,y1,x2,y2,…,xn,yn)

     

    x=43 91 18 26 15

    plot(x)

     

    x=0:0.1:2*3.14

    y=sin(x)

    plot(x,y)

     

    x=1:5

    y=rand(4,5)

    plot(x,y)

     

    x1=0:0.1:2*3.14

    y1=sin(x1)

    x2=3.14:0.1:3*3.14

    y2=cos(x2)

    plot(x1,y1,x2,y2)

     

    plot(x,y1x,y2)

     

    polar(theta,rho) 极坐标

    a-2*pi:0.001:2*pi; %设定角度

    b=(1-sin(a)); %设定对应角度的半径

    polar(a,b) %绘图

     

    pi

     

    polar([a a a],[b c d])

     

    plot(x,y,线的格式)

    ‘-‘ solid line(default)

    ‘- -‘ dashed line

    ‘:’ dotted line

    ‘-.’ dash-dotted line

    ‘linestyle’,‘none’ no line

     

    plot(x,y, ‘linestyle’,‘none’)

     

    plot(x,y,线的颜色)

    ‘yellow’ ‘y’ [1 1 0]

    ‘magenta’ ‘m’ [1 0 1]

    ‘cyan’ ‘c’ [0 1 1]

    ‘red’ ‘r’ [1 0 0]

    ‘green’ ‘g’ [0 1 0]

    ‘blue’ ‘b’ [0 0 1]

    ‘white’ ‘w’ [1 1 1]

    ‘black’ ‘k’ [0 0 0]

     

    a=0:0.1:2*pi

    b=sin(a)

    plot(a,b,’color’,’red’)

    plot(a,b,’:m’)

    plot(a,b,’- -k’)

     

    plot(x,y,数据点的格式)

    ‘o’ circle

    ‘+’ plus sign

    ‘*’ asterisk

    ‘.’ point

    ‘x’ cross

    ‘square’or’s’ square

    ‘diamond’or’d’ diamond

    ‘^’ upward-pointing triangle

    ‘v’ downward-pointing triangle

    ‘>’ right-pointing triangle

    ‘<’ left-pointing triangle

    ‘pentagram’or’p’ five-pointed star(pentagram)

    ‘hexagram’or’h’ six-pointed star(hexagram)

    ‘none’ no markers

     

    plot(x,y,'marker','+')

    plot(x,y, ,'o')

    plot(x,y, ,'-ro')

     

    plot(x,y,格式)

    plot(x,y,属性名称,属性值)

    ‘linewidth’ 0.5(default)

    ‘markeredgecolor’ auto(default)

    ‘markerfacecolor’ none(default)

    ‘markersize’ 6(default)

     

    x=0:0.1:2*pi;

    y=sin(x);

    polt(x,y,’linewidth’,6);

    polt(x,y,’o’,’ markeredgecolor’,’r’);

    polt(x,y,’o’,’ markerfacecolorr’,’r’);

    polt(x,y,’ markersize’,12);

     

    subplot(x,y,i)

     

    x=0:0.1:2*pi;

    y1=sin(x);

    y2=cos(x);

    y3=x;

    y4=x.^2;

    subplot(2,2,1),plot(x,y1);

    subplot(2,2,2),plot(x,y2);

    subplot(2,2,3),plot(x,y3);

    subplot(2,2,4),plot(x,y4);

     

    hold on

    hold off

     

    x=0:0.1:2*pi;

    y1=sin(x);

    y2=cos(x);

    y3=1-sin(x);

    plot(x,y1);

    hold on;

    plot(x,y2);

    hold off;

    plot(x,y3);

     

    坐标轴范围

    axis([x轴范围,y轴范围])

    axis auto

    axis manual 叠加绘图

    axis tight 紧凑型

     

    坐标轴比例

    axis equal 比例相同

    axis square 方形

    axis normal 默认

     

    关闭

    axis off

     

    x=0:0.1:4*pi;

    y=sin(x);

    x2=-100:100;

    y2=cos(x2)

    plot(x,y);axis tight;

    plot(x,y); axis ([-100 100 -100 100]);

     

    plot(x,y);axis manual;

    hold on;

    plot(x2,y2);

     

    x=0:0.1:10*pi;

    y=sin(x);

    plot(x,y);axis equal;

    plot(x,y);axis square;

    plot(x,y);axis nomal;

    plot(x,y);axis tight nomal;

    plot(x,y);axis off;

     

    ctrl+t 取消注释

     

    set

    set(gca,’xTick’,刻度)

    set(gca,’xTickLabel’,刻度标签)

     

    x=0:0.1:2*pi;

    y=sin(x);

    plot(x,y);

    set(gca,’xTick’,[0 pi/2 pi 3*pi/2 2*pi]) ;

    set(gca,’xTickLabel’,{‘0’ ‘pi/2’ ‘pi’ ‘3*pi/2’ ‘2*pi’})

     

     

    全对数/半对数

    25 VS 0.1

    semilogx X轴使用对数

    semilogy Y轴使用对数

    loglog XY轴均采用对数

     

    x=0:0.1:10;

    y=exp(x);

    subplot(2,2,1),plot(x,y);

    subplot(2,2,2), semilogx(x,y);

    subplot(2,2,3), semilogy(x,y);

    subplot(2,2,4),loglog(x,y);

     

    plotyy

    x=1:100;

    y1=rand(1,100)*1000;

    y2=x.^2;

    plot(x,y1,x,y2);

     

    plotyy(X1,Y1,X2,Y2)

    [AX,H1,H2]=plotyy(参数)

    AX AX(1)左侧坐标句柄,AX(2)右侧坐标句柄

    H1 左侧坐标图线句柄

    H2 右侧坐标图线句柄

     

    x=1:100;

    y1=rand(1,100);

    y2=x.^2;

    [ax ha hb]=plotyy(x,y1,x,y2);

    set(ha,’color’,’g’);

    set(hb,’color’,’m’);

    ylabel(ax(1),’随机数’);

    ylabel(ax(2),’平方’);

     

    axis on/axis off 坐标轴

    box on/box off 边界线

    grid on/grid off 网格线

     

    x=1:0.1:2*pi;

    y=sin(x);

    subplot(2,2,1),plot(x,y);

    subplot(2,2,2),plot(x,y),axis off;

    subplot(2,2,3),plot(x,y),box off;

    subplot(2,2,4),plot(x,y),grid on;

    for 循环变量=开始值:[步长]:终止值

    语句体

    end

     

    for i=1:5

    i

    end

     

    for i=2:4:14

    i

    end

     

    a=5;

    while a<10

    a

    a=a+1;

    end

     

    for i=1:5

    if i==3

    continue

    end

    i

    end

     

    for i=1:5

    if i==3

    break

    end

    i

    end

     

    try

    语句1

    catch

    语句2

    end

     

    a=ones(3,3)

    a(14,:)

     

    det(rand(2,4)) 取行列式

    a=6

    a

    try

    det(rand(2,4))

    catch

    disp(laster)

    end

     

    try

    a(14,:)

    catch

    disp(‘发生错误,具体为:’)

    disp(lasterr)

    end

     

    try

    a(14,:)

    catch

    disp(‘error’)

    disp(lasterr)

    end

     

    新建脚本

    for i=1:100

    i

    end

    ctrl+s保存在默认文件夹下

     

    clear all

     

    创建新文档

    函数

    输出 输入

     

    function [ c ] = myadd( a,b )

    %UNTITLED3 此处显示有关此函数的摘要

    %   此处显示详细说明

    %   c=a+b

        c=a+b

    end

    ctrl+S(区分大小写)

     

    % 注释

     

    myadd(4,6 )

     

    x=1:10

    y=sin(x)

    line(x,y)

     

    x=1:0.01:10

    y=sin(x)

    line(x,y)

     

    F5 运行

    ctrl+R 快速注释

     

    plot函数

    plot(x)

    plot(x,y)

    plot(x1,y1,x2,y2,…,xn,yn)

     

    x=43 91 18 26 15

    plot(x)

     

    x=0:0.1:2*3.14

    y=sin(x)

    plot(x,y)

     

    x=1:5

    y=rand(4,5)

    plot(x,y)

     

    x1=0:0.1:2*3.14

    y1=sin(x1)

    x2=3.14:0.1:3*3.14

    y2=cos(x2)

    plot(x1,y1,x2,y2)

     

    plot(x,y1x,y2)

     

    polar(theta,rho) 极坐标

    a-2*pi:0.001:2*pi; %设定角度

    b=(1-sin(a)); %设定对应角度的半径

    polar(a,b) %绘图

     

    pi

     

    polar([a a a],[b c d])

     

    plot(x,y,线的格式)

    ‘-‘ solid line(default)

    ‘- -‘ dashed line

    ‘:’ dotted line

    ‘-.’ dash-dotted line

    ‘linestyle’,‘none’ no line

     

    plot(x,y, ‘linestyle’,‘none’)

     

    plot(x,y,线的颜色)

    ‘yellow’ ‘y’ [1 1 0]

    ‘magenta’ ‘m’ [1 0 1]

    ‘cyan’ ‘c’ [0 1 1]

    ‘red’ ‘r’ [1 0 0]

    ‘green’ ‘g’ [0 1 0]

    ‘blue’ ‘b’ [0 0 1]

    ‘white’ ‘w’ [1 1 1]

    ‘black’ ‘k’ [0 0 0]

     

    a=0:0.1:2*pi

    b=sin(a)

    plot(a,b,’color’,’red’)

    plot(a,b,’:m’)

    plot(a,b,’- -k’)

     

    plot(x,y,数据点的格式)

    ‘o’ circle

    ‘+’ plus sign

    ‘*’ asterisk

    ‘.’ point

    ‘x’ cross

    ‘square’or’s’ square

    ‘diamond’or’d’ diamond

    ‘^’ upward-pointing triangle

    ‘v’ downward-pointing triangle

    ‘>’ right-pointing triangle

    ‘<’ left-pointing triangle

    ‘pentagram’or’p’ five-pointed star(pentagram)

    ‘hexagram’or’h’ six-pointed star(hexagram)

    ‘none’ no markers

     

    plot(x,y,'marker','+')

    plot(x,y, ,'o')

    plot(x,y, ,'-ro')

     

    plot(x,y,格式)

    plot(x,y,属性名称,属性值)

    ‘linewidth’ 0.5(default)

    ‘markeredgecolor’ auto(default)

    ‘markerfacecolor’ none(default)

    ‘markersize’ 6(default)

     

    x=0:0.1:2*pi;

    y=sin(x);

    polt(x,y,’linewidth’,6);

    polt(x,y,’o’,’ markeredgecolor’,’r’);

    polt(x,y,’o’,’ markerfacecolorr’,’r’);

    polt(x,y,’ markersize’,12);

     

    subplot(x,y,i)

     

    x=0:0.1:2*pi;

    y1=sin(x);

    y2=cos(x);

    y3=x;

    y4=x.^2;

    subplot(2,2,1),plot(x,y1);

    subplot(2,2,2),plot(x,y2);

    subplot(2,2,3),plot(x,y3);

    subplot(2,2,4),plot(x,y4);

     

    hold on

    hold off

     

    x=0:0.1:2*pi;

    y1=sin(x);

    y2=cos(x);

    y3=1-sin(x);

    plot(x,y1);

    hold on;

    plot(x,y2);

    hold off;

    plot(x,y3);

     

    坐标轴范围

    axis([x轴范围,y轴范围])

    axis auto

    axis manual 叠加绘图

    axis tight 紧凑型

     

    坐标轴比例

    axis equal 比例相同

    axis square 方形

    axis normal 默认

     

    关闭

    axis off

     

    x=0:0.1:4*pi;

    y=sin(x);

    x2=-100:100;

    y2=cos(x2)

    plot(x,y);axis tight;

    plot(x,y); axis ([-100 100 -100 100]);

     

    plot(x,y);axis manual;

    hold on;

    plot(x2,y2);

     

    x=0:0.1:10*pi;

    y=sin(x);

    plot(x,y);axis equal;

    plot(x,y);axis square;

    plot(x,y);axis nomal;

    plot(x,y);axis tight nomal;

    plot(x,y);axis off;

     

    ctrl+t 取消注释

     

    set

    set(gca,’xTick’,刻度)

    set(gca,’xTickLabel’,刻度标签)

     

    x=0:0.1:2*pi;

    y=sin(x);

    plot(x,y);

    set(gca,’xTick’,[0 pi/2 pi 3*pi/2 2*pi]) ;

    set(gca,’xTickLabel’,{‘0’ ‘pi/2’ ‘pi’ ‘3*pi/2’ ‘2*pi’})

     

     

    全对数/半对数

    25 VS 0.1

    semilogx X轴使用对数

    semilogy Y轴使用对数

    loglog XY轴均采用对数

     

    x=0:0.1:10;

    y=exp(x);

    subplot(2,2,1),plot(x,y);

    subplot(2,2,2), semilogx(x,y);

    subplot(2,2,3), semilogy(x,y);

    subplot(2,2,4),loglog(x,y);

     

    plotyy

    x=1:100;

    y1=rand(1,100)*1000;

    y2=x.^2;

    plot(x,y1,x,y2);

     

    plotyy(X1,Y1,X2,Y2)

    [AX,H1,H2]=plotyy(参数)

    AX AX(1)左侧坐标句柄,AX(2)右侧坐标句柄

    H1 左侧坐标图线句柄

    H2 右侧坐标图线句柄

     

    x=1:100;

    y1=rand(1,100);

    y2=x.^2;

    [ax ha hb]=plotyy(x,y1,x,y2);

    set(ha,’color’,’g’);

    set(hb,’color’,’m’);

    ylabel(ax(1),’随机数’);

    ylabel(ax(2),’平方’);

     

    axis on/axis off 坐标轴

    box on/box off 边界线

    grid on/grid off 网格线

     

    x=1:0.1:2*pi;

    y=sin(x);

    subplot(2,2,1),plot(x,y);

    subplot(2,2,2),plot(x,y),axis off;

    subplot(2,2,3),plot(x,y),box off;

    subplot(2,2,4),plot(x,y),grid on;

  • lolitapanis 2020-07-04 11:06:57

    来源:for语句 查看详情

    B=a+5

    B=a-5

    B=a*8

    B=a/4

     

    B=a^2

    B=a^(-1)

     

    A+b

    a-b

     

    a*b

     

    a/b a*b的逆矩阵

    a*inv(b) 数组求逆函数

    A*pinv(b) 广义数组求逆函数

    a\b a的逆矩阵*b

    inv(a)*b

    pinv(a)*b

     

    a.*b=b.*a

     

    a.\b=b./a

     

    a.^3

    3.^a

    a.^b

     

    a=true

    b=false

    a=true(3)

    b=false(4)

    真:非0的值

    假:0

     

    >

    <

    ==

    >=

    <=

    ~=

    5>8

    5==5
    2~=9

    a>b

     

    and(3,0)

    3&0

    And(a,b)

    A&b

     

    Or(a,b)

    A|b

     

    非=取反

     Not(a)

    ~a

     

    Xor(a,b) 异或

     

    B=any(A)  A为向量、矩阵、[]

    B=any(A,dim)

    B=any(A,1) 列计算

    B=any(A,2) 行计算

     

    B=all(A) A为向量、矩阵、[](不存在0)

    B= all (A,dim)

    B= all (A,1) 列计算

    B= all (A,2) 行计算

     

    Short-circuit

    && 运算数必须为标量

    || 运算数必须为标量

    B=0

    X=(b~=0)&&(a/b>18.5)

     

    顺序结构、选择结构、循环结构、错误控制结构

    Return终止,break,continue,input,error,keyboard,pause

     

    If 逻辑表达式1

    语句1

    Elseif 逻辑表达式2

    语句2

    Else

    语句3

    End

     

    X赋初始值

    If x是偶数

    输出“偶数”

    End

     

    语法格式

    X赋初始值

    If x是偶数

    输出“偶数”

    End

     

    X=6

    If rem(x,2)==0

    Disp(‘偶数’)

    End

     

    A=6

    If rem(a,2)==0

    Disp(‘even’)

     

    A=7

    If rem(a,2)==0

    Disp(‘even’)

    End

    If rem(a,2)==1

    Disp(‘odd’)

    End

     

    A=8

    If rem(a,2)==0

    Disp(‘even’)

    Else

    Disp(‘odd’)

    End

     

    a=8

    If a>0

    disp(‘a>0’)

    elseif a==0

    disp(‘a=0’)

    else

    disp(‘a<0’)

    end

     

    switch 表达式

    case 值1

    语句1

    case 值2

    语句2

    ......

    otherwise

    语句n

    end

     

    month=3

    switch month

    case 3

    season=’spring’

    case 4

    season=’spring’

    case 5

    season=’spring’

    case{6,7,8}

    season=’summer’

    case{9,10,11}

    season=’autumn’

    otherwise

    season=’winter’

    end

    元胞数组

    month=4;

    switch month

  • lolitapanis 2020-06-24 15:13:11

    来源:reshape函数 查看详情

    c=blkdiag(a,b,d)

     

    c=kron(a,b)

    a

    b

     

    a(5,8)=9

     

    b=a([1,2,3],[2,3,4])

    b=a([1,2,3],[5,4,1])

     

    m:n

    b=a(1:3,4:5)

    b=a([1,2,3],5:6)

     

    m:k:n

    b=a(1:3:9,2:3:9)

    b=a(1:2:5,1:5)

     

    b=a(3:5,:)

    b=a(:,3:6)

     

    a([1:3],:)=[]

    a([3,4],:)=[]

     

    ,’

    Transpose(a)

    Ctranspose(a)

     

    ‘  共轭转置

    .’  非共轭转置

    Ctranspose(a)  共轭转置

    Transpose(a)  非共轭转置

    A=rand(3,4)+rand(3,4)*i

     

    B=flipud(a)  up down

     

    B=fliplr(a)  left right

     

    B=flipdim(a) 不被官方推荐

    B=flip(a) 相当于ud

    B=flip(a,1) 相当于ud

    B=flip(a,2) 相当于lr

     

    B=rot90(a,k) 逆时针旋转k个90°

    B=rot90(a,-1) 顺时针旋转90°

     

    B=reshape(a,2,9)

没有更多了