Mudanças entre as edições de "FIC MATLAB 2017-1/Aula-3"
Ir para navegação
Ir para pesquisar
(Criou página com '%-- 13-03-2017 19:18:41 --% clear clc dhgkash asad hsd hsd hs clc % Voltando à plotagem da aula anterior x = linspace(0,4*pi,1000); y = sin(x); plot(x,y) grid on % Exemplo de li...') |
|||
Linha 1: | Linha 1: | ||
− | %-- 13-03-2017 19:18:41 --% | + | %-- 13-03-2017 19:18:41 --% |
− | + | % Voltando à plotagem da aula anterior | |
− | + | x = linspace(0,4*pi,1000); | |
− | + | y = sin(x); | |
− | + | plot(x,y) | |
− | + | grid on | |
− | + | % Exemplo de linspace | |
− | + | linspace(2,8,5) | |
− | + | % Construindo outra curva | |
− | % Voltando à plotagem da aula anterior | + | z = cos(x); |
− | x = linspace(0,4*pi,1000); | + | hold on |
− | y = sin(x); | + | stem(x,z) |
− | plot(x,y) | + | help hold |
− | grid on | + | plot(x,z) |
− | % Exemplo de linspace | + | xlabel('Valores de x') |
− | linspace(2,8,5) | + | ylabel('cos(x) e sen(x)') |
− | % Construindo outra curva | + | ylabel('cos(x) e sen(\omega)') |
− | z = cos(x); | + | title('Gráfico da aula de FIC MATLAB') |
− | hold on | + | axis([0 4*pi -1.1 1.1]) |
− | stem(x,z) | + | clc |
− | help hold | + | % Outros comandos sobre Plot |
− | plot(x,z) | + | figure |
− | xlabel('Valores de x') | + | figure(1) |
− | ylabel('cos(x) e sen(x)') | + | figure(2) |
− | ylabel('cos(x) e sen(\omega)') | + | figure(1) |
− | title('Gráfico da aula de FIC MATLAB') | + | figure(2) |
− | axis([0 4*pi -1.1 1.1]) | + | stem(ans) |
− | clc | + | plot(sin(x)) |
− | % Outros comandos sobre Plot | + | % Plotando mais d eum gráfico em uma figura |
− | figure | + | y = sin(x); |
− | figure(1) | + | z = cos(x); |
− | figure(2) | + | figure |
− | figure(1) | + | subplot(2,1,1) |
− | figure(2) | + | plot(x,y) |
− | stem(ans) | + | xlabel('x') |
− | plot(sin(x)) | + | ylabel('sin(x)') |
− | % Plotando mais d eum gráfico em uma figura | + | grid on |
− | y = sin(x); | + | title('Plot de um seno') |
− | z = cos(x); | + | subplot(2,1,2) |
− | figure | + | plot(x,z) |
− | subplot(2,1,1) | + | xlabel('x') |
− | plot(x,y) | + | ylabel('cos(x)') |
− | xlabel('x') | + | grid on |
− | ylabel('sin(x)') | + | title('Plot de um cosseno') |
− | grid on | + | % Adicionando uma legenda |
− | title('Plot de um seno') | + | figure(1) |
− | subplot(2,1,2) | + | doc legend |
− | plot(x,z) | + | legend('sen(x)','cos(x)','Ligando os pontos') |
− | xlabel('x') | + | close all |
− | ylabel('cos(x)') | + | linspace(2,8,5) |
− | grid on | + | linspace(2,9,5) |
− | title('Plot de um cosseno') | + | edit nova_script.m |
− | % Adicionando uma legenda | + | nova_script |
− | figure(1) | + | doc fplot |
− | doc legend | + | clc |
− | legend('sen(x)','cos(x)','Ligando os pontos') | + | % Atributos |
− | close all | + | y = sin(x); |
− | linspace(2,8,5) | + | plot(x,y,'--') |
− | linspace(2,9,5) | + | plot(x,y,'-.') |
− | edit nova_script.m | + | plot(x,y,':') |
− | nova_script | + | plot(x,y,'--k') |
− | doc fplot | + | plot(x,y,'--r') |
− | clc | + | plot(x,y,'--y') |
− | % Atributos | + | plot(x,y,'--m') |
− | y = sin(x); | + | plot(x,y,'--g') |
− | plot(x,y,'--') | + | plot(x,y,'--k') |
− | plot(x,y,'-.') | + | plot(x,y,'--k*') |
− | plot(x,y,':') | + | plot(x,y,'--k^') |
− | plot(x,y,'--k') | + | edit meuscript.m |
− | plot(x,y,'--r') | + | plot(x,y,'--k^') |
− | plot(x,y,'--y') | + | close all |
− | plot(x,y,'--m') | + | plot(x,y,'--k^') |
− | plot(x,y,'--g') | + | clear all |
− | plot(x,y,'--k') | + | % Endereçamento de vetores e matrizes |
− | plot(x,y,'--k*') | + | Lin = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
− | plot(x,y,'--k^') | + | Lin = [0 1 2 3 4 5 6 7 8 9] |
− | edit meuscript.m | + | Lin = [0 1 2 3 4.2 5 6 7 8 9] |
− | plot(x,y,'--k^') | + | Lin = [0 1 2 3 4 5 6 7 8 9] |
− | close all | + | Col = [10; 11; 12; 13; 14; 15; 16; 17; 18; 19] |
− | plot(x,y,'--k^') | + | Lin = 0:1:9 |
− | clear all | + | Lin = 0:9 |
− | % Endereçamento de vetores e matrizes | + | Col = [10:19]' |
− | Lin = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | + | Col = (10:19)' |
− | Lin = [0 1 2 3 4 5 6 7 8 9] | + | Mat = [0 1 2 3; 4 5 6 7; 8 9 10 11] |
− | Lin = [0 1 2 3 4.2 5 6 7 8 9] | + | Mat = [0 1 2 3 |
− | Lin = [0 1 2 3 4 5 6 7 8 9] | + | 4 5 6 7 |
− | Col = [10; 11; 12; 13; 14; 15; 16; 17; 18; 19] | + | 8 9 10 11] |
− | Lin = 0:1:9 | + | 0:89 |
− | Lin = 0:9 | + | % Comando reshape |
− | Col = [10:19]' | + | Mat = reshape(0:89, 9, 10) |
− | Col = (10:19)' | + | Mat = reshape(0:89, 10, 9)' |
− | Mat = [0 1 2 3; 4 5 6 7; 8 9 10 11] | + | A = [1 2 3; 4 5 6] |
− | Mat = [0 1 2 3 | + | reshape(A, 3, 2) |
− | 4 5 6 7 | + | A |
− | 8 9 10 11] | + | A' |
− | 0:89 | + | A |
− | % Comando reshape | + | reshape(A, 3, 2) |
− | Mat = reshape(0:89, 9, 10) | + | reshape(A, 3, []) |
− | Mat = reshape(0:89, 10, 9)' | + | Mat = reshape(0:89, 10, [])' |
− | A = [1 2 3; 4 5 6] | + | Mat = reshape(0:89, 5, [])' |
− | reshape(A, 3, 2) | + | size(Mat) |
− | A | + | Mat = reshape(0:89, [], 18)' |
− | A' | + | A |
− | A | + | reshape(A, 3, 5) |
− | reshape(A, 3, 2) | + | reshape(A, 4, 2) |
− | reshape(A, 3, []) | + | reshape(A, 4, 1) |
− | Mat = reshape(0:89, 10, [])' | + | numel(A) |
− | Mat = reshape(0:89, 5, [])' | + | A |
− | size(Mat) | + | % Comando repmat |
− | Mat = reshape(0:89, [], 18)' | + | repmat(A, 2, 3) |
− | A | + | numel(ans) |
− | reshape(A, 3, 5) | + | repmat(A, 2, 3) |
− | reshape(A, 4, 2) | + | numel ans |
− | reshape(A, 4, 1) | + | Lin |
− | numel(A) | + | Col |
− | A | + | Mat |
− | % Comando repmat | + | Mat = reshape(0:89, 10, 9)' |
− | repmat(A, 2, 3) | + | % Indexação de vetores e matrizes |
− | numel(ans) | + | Lin |
− | repmat(A, 2, 3) | + | Lin_1 = Lin(1) |
− | numel ans | + | Col_3 = Col(3) |
− | Lin | + | Mat_2_4 = Mat(2, 4) |
− | Col | + | Mat_6 = Mat(6) |
− | Mat | + | Mat(12) |
− | Mat = reshape(0:89, 10, 9)' | + | Lin |
− | % Indexação de vetores e matrizes | + | Lin_2a5 = Lin(2:5) |
− | Lin | + | Col |
− | Lin_1 = Lin(1) | + | Col_1a7 = Col(1:7) |
− | Col_3 = Col(3) | + | Mat |
− | Mat_2_4 = Mat(2, 4) | + | Mat_3_5a8 = Mat(3, 5:8) |
− | Mat_6 = Mat(6) | + | Mat_3a7_8 = Mat(3:7, 8) |
− | Mat(12) | + | Mat_3_T = Mat(3, []) % Será que funciona? |
− | Lin | + | Mat_3_T = Mat(3, :) |
− | Lin_2a5 = Lin(2:5) | + | Mat_T_5 = Mat(:, 5) |
− | Col | + | Mat_T_5 = Mat(:, :) |
− | Col_1a7 = Col(1:7) | + | Mat_T_5 = Mat(:, 5) |
− | Mat | + | Lin |
− | Mat_3_5a8 = Mat(3, 5:8) | + | Lin_3aE = Lin(3:end) |
− | Mat_3a7_8 = Mat(3:7, 8) | + | Col |
− | Mat_3_T = Mat(3, []) % Será que funciona? | + | Col_5aE = Col(5:end) |
− | Mat_3_T = Mat(3, :) | + | Mat |
− | Mat_T_5 = Mat(:, 5) | + | Mat_5aE_4aE = Mat(5:end, 4:end) |
− | Mat_T_5 = Mat(:, :) | + | Lin |
− | Mat_T_5 = Mat(:, 5) | + | Lin_384 = Lin([3 8 4]) |
− | Lin | + | Lin(3:5) |
− | Lin_3aE = Lin(3:end) | + | Lin([3 4 5]) |
− | Col | + | Col |
− | Col_5aE = Col(5:end) | + | Col_922 = Col([9 2 2]) |
− | Mat | + | Mat_74_8 = Mat([7 4], 8) |
− | Mat_5aE_4aE = Mat(5:end, 4:end) | + | Mat_34_86 = Mat([3 4], [8 6]) |
− | Lin | + | Mat |
− | Lin_384 = Lin([3 8 4]) | + | % Indexação do lado esquerdo do sinal de igualdade |
− | Lin(3:5) | + | Mat6 = Mat(6) |
− | Lin([3 4 5]) | + | Mat(6) = 18 |
− | Col | + | Mat(6:8, 7:end) = 0 |
− | Col_922 = Col([9 2 2]) | + | Mat(2:2:6, 1:4) = 1 |
− | Mat_74_8 = Mat([7 4], 8) | + | A = [321 234 312; 234 234 123] |
− | Mat_34_86 = Mat([3 4], [8 6]) | + | Mat(1:2, 8:end) = A |
− | Mat | + | % Removendo linhas ou colunas |
− | % Indexação do lado esquerdo do sinal de igualdade | + | Mat(:, [2 4]) = [] |
− | Mat6 = Mat(6) | + | Mat |
− | Mat(6) = 18 | ||
− | Mat(6:8, 7:end) = 0 | ||
− | Mat(2:2:6, 1:4) = 1 | ||
− | A = [321 234 312; 234 234 123] | ||
− | Mat(1:2, 8:end) = A | ||
− | % Removendo linhas ou colunas | ||
− | Mat(:, [2 4]) = [] | ||
− | Mat |
Edição atual tal como às 11h02min de 14 de março de 2017
%-- 13-03-2017 19:18:41 --% % Voltando à plotagem da aula anterior x = linspace(0,4*pi,1000); y = sin(x); plot(x,y) grid on % Exemplo de linspace linspace(2,8,5) % Construindo outra curva z = cos(x); hold on stem(x,z) help hold plot(x,z) xlabel('Valores de x') ylabel('cos(x) e sen(x)') ylabel('cos(x) e sen(\omega)') title('Gráfico da aula de FIC MATLAB') axis([0 4*pi -1.1 1.1]) clc % Outros comandos sobre Plot figure figure(1) figure(2) figure(1) figure(2) stem(ans) plot(sin(x)) % Plotando mais d eum gráfico em uma figura y = sin(x); z = cos(x); figure subplot(2,1,1) plot(x,y) xlabel('x') ylabel('sin(x)') grid on title('Plot de um seno') subplot(2,1,2) plot(x,z) xlabel('x') ylabel('cos(x)') grid on title('Plot de um cosseno') % Adicionando uma legenda figure(1) doc legend legend('sen(x)','cos(x)','Ligando os pontos') close all linspace(2,8,5) linspace(2,9,5) edit nova_script.m nova_script doc fplot clc % Atributos y = sin(x); plot(x,y,'--') plot(x,y,'-.') plot(x,y,':') plot(x,y,'--k') plot(x,y,'--r') plot(x,y,'--y') plot(x,y,'--m') plot(x,y,'--g') plot(x,y,'--k') plot(x,y,'--k*') plot(x,y,'--k^') edit meuscript.m plot(x,y,'--k^') close all plot(x,y,'--k^') clear all % Endereçamento de vetores e matrizes Lin = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Lin = [0 1 2 3 4 5 6 7 8 9] Lin = [0 1 2 3 4.2 5 6 7 8 9] Lin = [0 1 2 3 4 5 6 7 8 9] Col = [10; 11; 12; 13; 14; 15; 16; 17; 18; 19] Lin = 0:1:9 Lin = 0:9 Col = [10:19]' Col = (10:19)' Mat = [0 1 2 3; 4 5 6 7; 8 9 10 11] Mat = [0 1 2 3 4 5 6 7 8 9 10 11] 0:89 % Comando reshape Mat = reshape(0:89, 9, 10) Mat = reshape(0:89, 10, 9)' A = [1 2 3; 4 5 6] reshape(A, 3, 2) A A' A reshape(A, 3, 2) reshape(A, 3, []) Mat = reshape(0:89, 10, [])' Mat = reshape(0:89, 5, [])' size(Mat) Mat = reshape(0:89, [], 18)' A reshape(A, 3, 5) reshape(A, 4, 2) reshape(A, 4, 1) numel(A) A % Comando repmat repmat(A, 2, 3) numel(ans) repmat(A, 2, 3) numel ans Lin Col Mat Mat = reshape(0:89, 10, 9)' % Indexação de vetores e matrizes Lin Lin_1 = Lin(1) Col_3 = Col(3) Mat_2_4 = Mat(2, 4) Mat_6 = Mat(6) Mat(12) Lin Lin_2a5 = Lin(2:5) Col Col_1a7 = Col(1:7) Mat Mat_3_5a8 = Mat(3, 5:8) Mat_3a7_8 = Mat(3:7, 8) Mat_3_T = Mat(3, []) % Será que funciona? Mat_3_T = Mat(3, :) Mat_T_5 = Mat(:, 5) Mat_T_5 = Mat(:, :) Mat_T_5 = Mat(:, 5) Lin Lin_3aE = Lin(3:end) Col Col_5aE = Col(5:end) Mat Mat_5aE_4aE = Mat(5:end, 4:end) Lin Lin_384 = Lin([3 8 4]) Lin(3:5) Lin([3 4 5]) Col Col_922 = Col([9 2 2]) Mat_74_8 = Mat([7 4], 8) Mat_34_86 = Mat([3 4], [8 6]) Mat % Indexação do lado esquerdo do sinal de igualdade Mat6 = Mat(6) Mat(6) = 18 Mat(6:8, 7:end) = 0 Mat(2:2:6, 1:4) = 1 A = [321 234 312; 234 234 123] Mat(1:2, 8:end) = A % Removendo linhas ou colunas Mat(:, [2 4]) = [] Mat