Too many input arguments ?
1 次查看(过去 30 天)
显示 更早的评论
I have the following m script that is going to ask a function in anuther m script. For some reason fixplot is being given too many input arguments and I don't know why.
Her is the code for the main function that will be calling the other function.
function lab5
% lab5.m
% You will provide the print-out for the following
clear all;
clc;
% A (non-causal) bandstop filter
figure
fizplot([1 2 2], [0 1 .8]);
title('A (non-causal) bandstop filter');
/// And her is the function it is trying to call and place its input through.
function fizplot(b, a)
clf;
b = b(:)';
a = a(:)';
fplot(b, a, 'XLim', [0 1], 'XTick', 0.25);
h = get(gcf, 'Children');
for i = 1:2
set(h(i), 'Units', 'normalized');
pos = get(h(i), 'Position');
pos(3) = 0.33;
set(h(i), 'Position', pos);
end
subplot(2, 2, 2);
zplot(b, a);
title(['H(z)=' bastrnew({b, a}, 1)]);
subplot(2, 2, 4);
iplot(b, a);
figure(gcf);
return
/// And this is the error message i keep getting every time I run the code.
Error using fplot
Too many input arguments.
Error in fizplot (line 15)
fplot(b, a, 'XLim', [0 1], 'XTick', 0.25);
Error in Lab5 (line 8)
fizplot([1 2 2], [0 1 .8]);
0 个评论
回答(2 个)
Basil C.
2019-8-5
The function fplot is used to plot functions. The input that you are providing are array elements so you could rather use
plot(b,a);
Also the function fplot does not take the limits of the functions (y=f(x)) as an argument, it can only take the limits to 'x'
0 个评论
Christopher Piland
2019-8-5
1 个评论
Walter Roberson
2019-8-5
You have
function fplot(b, a)
That accepts only two arguments
fplot(b, a, 'XLim', [0 1], 'XTick', 0.25);
Tries to call fplot with 6 arguments.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!