Buscar

Como elaborar uma função que receba como parâmetros, a freqüência, o número de pontos e o tempo de simulação e retorne dois vetores, um contendo

Elaborar uma função que receba como parâmetros, a freqüência, o número de pontos e o tempo de simulação e retorne dois vetores, um contendo o tempo e outro contendo a amplitude de uma onda triangular simétrica de amplitude 1. Desenvolver também um programa em Matlab que invoque a função criada e plote um gráfico com os pontos da onda triangular retornados pela função.

💡 4 Respostas

User badge image

Davi Lima

deve ser

0
Dislike0
User badge image

Andre Smaira

A função será invocada pelo matlab e executada por seguinte código:

unction colorPlanesPlot(rPlane, gPlane, bPlane, justGreen)

%CREATEFIGURE(rPlane,gPlane,bPlane,justGreen)

% rPlane: image cdata

% gPlane: image cdata

% bPlane: image cdata

% justGreen: image cdata

% Auto-generated by MATLAB on 21-Dec-2012 14:13:16

% Copyright 2012-2014 The MathWorks, Inc.

% Create figure

% Create subplot

subplot1 = subplot(2,2,1,´Parent´,figure1,´YDir´,´reverse´,´Layer´,´top´);

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot1,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot1,[0.5 240.5]);

box(subplot1,´on´);

hold(subplot1,´all´);

% Create image

image(rPlane,´Parent´,subplot1,´CDataMapping´,´scaled´);

% Create title

title(´R´);

% Create subplot

subplot2 = subplot(2,2,2,´Parent´,figure1,´YDir´,´reverse´,´Layer´,´top´);

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot2,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot2,[0.5 240.5]);

box(subplot2,´on´);

hold(subplot2,´all´);

% Create image

image(gPlane,´Parent´,subplot2,´CDataMapping´,´scaled´);

% Create title

title(´G´);

% Create subplot

subplot3 = subplot(2,2,3,´Parent´,figure1,´YDir´,´reverse´,´Layer´,´top´,...

´CLim´,[0 255]);

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot3,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot3,[0.5 240.5]);

box(subplot3,´on´);

hold(subplot3,´all´);

% Create image

image(bPlane,´Parent´,subplot3,´CDataMapping´,´scaled´);

% Create title

title(´B´);

% Create subplot

subplot4 = subplot(2,2,4,´Parent´,figure1,´YDir´,´reverse´,´Layer´,´top´);

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot4,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot4,[0.5 240.5]);

box(subplot4,´on´);

hold(subplot4,´all´);

% Create title

title(´Just Green´);

% Create image

image(justGreen,´Parent´,subplot4,´CDataMapping´,´scaled´);

0
Dislike0
User badge image

Andre Smaira

Algoritmos


A função será invocada pelo matlab e executada por seguinte código:

unction colorPlanesPlot(rPlane, gPlane, bPlane, justGreen)

%CREATEFIGURE(rPlane,gPlane,bPlane,justGreen)

% rPlane: image cdata

% gPlane: image cdata

% bPlane: image cdata

% justGreen: image cdata

% Auto-generated by MATLAB on 21-Dec-2012 14:13:16

% Copyright 2012-2014 The MathWorks, Inc.

% Create figure

% Create subplot

subplot1 = subplot(2,2,1,'Parent',figure1,'YDir','reverse','Layer','top');

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot1,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot1,[0.5 240.5]);

box(subplot1,'on');

hold(subplot1,'all');

% Create image

image(rPlane,'Parent',subplot1,'CDataMapping','scaled');

% Create title

title('R');

% Create subplot

subplot2 = subplot(2,2,2,'Parent',figure1,'YDir','reverse','Layer','top');

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot2,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot2,[0.5 240.5]);

box(subplot2,'on');

hold(subplot2,'all');

% Create image

image(gPlane,'Parent',subplot2,'CDataMapping','scaled');

% Create title

title('G');

% Create subplot

subplot3 = subplot(2,2,3,'Parent',figure1,'YDir','reverse','Layer','top',...

'CLim',[0 255]);

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot3,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot3,[0.5 240.5]);

box(subplot3,'on');

hold(subplot3,'all');

% Create image

image(bPlane,'Parent',subplot3,'CDataMapping','scaled');

% Create title

title('B');

% Create subplot

subplot4 = subplot(2,2,4,'Parent',figure1,'YDir','reverse','Layer','top');

%% Uncomment the following line to preserve the X-limits of the axes

xlim(subplot4,[0.5 320.5]);

%% Uncomment the following line to preserve the Y-limits of the axes

ylim(subplot4,[0.5 240.5]);

box(subplot4,'on');

hold(subplot4,'all');

% Create title

title('Just Green');

% Create image

image(justGreen,'Parent',subplot4,'CDataMapping','scaled');

0
Dislike0

Faça como milhares de estudantes: teste grátis o Passei Direto

Esse e outros conteúdos desbloqueados

16 milhões de materiais de várias disciplinas

Impressão de materiais

Agora você pode testar o

Passei Direto grátis


✏️ Responder

SetasNegritoItálicoSublinhadoTachadoCitaçãoCódigoLista numeradaLista com marcadoresSubscritoSobrescritoDiminuir recuoAumentar recuoCor da fonteCor de fundoAlinhamentoLimparInserir linkImagemFórmula

Para escrever sua resposta aqui, entre ou crie uma conta.

User badge image

Outros materiais