I am trying to plot sequences, I have written a function
function show_seq(seq)
plot (seq)
end
I now want to overload this show_seq to show 2 sequences something like
function show_seq(seq1, seq2)
plot(seq1,'color','r');
plot(seq2, 'color', 'b');
end
but this does not work, does anyone have idea about how to overload functions in MATLAB?
You can overload one of your own functions if you put the overloading function in a path that with higher precedence. For more details on path precedence, see this question.
However, in your case, the easiest would be to modify
show_seqso that it accepts multiple optional inputs: