how does global function work in this code?
    4 views (last 30 days)
  
       Show older comments
    
Hi, I am kind of beginner in MATLAB and I try to use the following code. It seems I should define p and q but I can not figure out how should I enter p and q to the code
      function [CL,e,psi,r] = ARMA_FULL(theta0, data)
  %function CL=ARMA_FULL(theta0,data)
% define the global vector
global p q;
x=data;
% initial parameter set theta0 is a column vector;
% c is the constant of the general ARMA model;
% ar is the (1*p) vector;
% ma is the (1*q) vector;
if p==0;
      % initial parameters for pure moving average model 
      y=x-mean(x);
      ma=theta0(2:end-1);
      s=theta0(end);
.
.
.
1 Comment
Accepted Answer
  per isakson
      
      
 on 5 Apr 2013
        
      Edited: per isakson
      
      
 on 5 Apr 2013
  
      Try
    >> global my_global
    >> my_global= 17
    my_global =
        17
    >> global_demo
        17
    >>
where
    function    global_demo()
       global my_global
       disp( my_global )
    end
0 Comments
More Answers (0)
See Also
Categories
				Find more on Whos in Help Center and File Exchange
			
	Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
