26 lines
487 B
Mathematica
26 lines
487 B
Mathematica
|
function diff_plot(iir_out, Script_out,leg1,leg2,a)
|
||
|
|
||
|
N = length(iir_out);
|
||
|
n = 0:1:N-1;
|
||
|
diff = iir_out-Script_out;
|
||
|
|
||
|
subplot(211)
|
||
|
plot(n,iir_out,n,Script_out)
|
||
|
xlabel('n')
|
||
|
legend(leg1,leg2)
|
||
|
xlim(a)
|
||
|
title('time domain')
|
||
|
grid on
|
||
|
|
||
|
subplot(212)
|
||
|
plot(n,diff)
|
||
|
xlabel('n')
|
||
|
title('diff')
|
||
|
grid on
|
||
|
hold on
|
||
|
xlim(a)
|
||
|
|
||
|
[diff_max,R_mpos] = max(abs(diff));
|
||
|
plot(n(R_mpos),diff(R_mpos),'r*')
|
||
|
text(n(R_mpos), diff(R_mpos), ['(',num2str(n(R_mpos)),',',num2str(diff(R_mpos)),')'],'color','k');
|
||
|
% max(abs(diff))
|