SFEplotma1 (MatLab R2007b)

plots two MA(1) processes

Download File

Tue, July 31 2012 by Dedy Dwi Prastyo

-


Description: -


close all
clear all
clc
RandStream.setDefaultStream(RandStream('mt19937ar','seed',100));
n1=10;
n2=20;
a = [1];              %ARcoeffs
b = [1 0.5];          %MAcoeffs;
e1 = randn(n1+50,1);  %generate gaussian white noise
e2 = randn(n2+50,1);  %generate gaussian white noise
y1 = filter(b,a,e1);  %generate y for n1
y2 = filter(b,a,e2);  %generate y for n2
subplot(2,1,1)
plot(y1(51:(n1+50)),'r-','LineWidth',2.5);
xlabel('t','FontSize',16,'FontWeight','Bold');
ylabel('y(t)','FontSize',16,'FontWeight','Bold');
str = sprintf('MA(1) process, n = %g ',n1);
title(str,'FontSize',16,'FontWeight','Bold');
box on
set(gca,'LineWidth',1.6,'FontSize',16,'FontWeight','Bold')
subplot(2,1,2)
plot(y2(51:(n2+50)),'b-','LineWidth',2.5);
xlabel('t','FontSize',16,'FontWeight','Bold');
ylabel('y(t)','FontSize',16,'FontWeight','Bold');
str = sprintf('MA(1) process, n = %g ',n2);
title(str,'FontSize',16,'FontWeight','Bold');
box on
set(gca,'LineWidth',1.6,'FontSize',16,'FontWeight','Bold')