Replace matlab function with user defined function in code

Hi, the existing function is as follows:
[a,e] = arburg(est_x1,PSam,k);
I would like to replace the arburg fucntion with the function in arburgw1.m in the code. How can I do that?

4 Comments

"How can I do that?"
x=r_t; % !!! get rid of this line of code !!!
p=PSam; % !!! get rid of this line of code !!!
function varargout= arburgw( x, p, ventana)
..
end
When you write code before the FUNCTION() definition then you are turning that Mfile into a script and you will not be able to call the function from anywhere else. If you want to be able call that function somewhere else, then do not turn the Mfile into a script.
thanks, how do i get [a,e] from this function?
function [a,e]= arburgw( x, p, ventana)
..
end
"how do i get [a,e] from this function?"
Once you write a callable function (i.e not a script, as explained in my last comment), then you can simply call it with those output arguments, just as the introductory tutorials show:
[a_out,e_out] = arburgw1(..)
Note that you should replace the evil EVAL() with slightly more robust FEVAL().

Sign in to comment.

Answers (0)

Categories

Tags

Asked:

on 30 Dec 2022

Commented:

on 30 Dec 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!