Matlab 出现的子函数输出问题.源M文件如下:&&&&&&&&&&&&&&&function [taxb,taxa,diff]=homework1income=input('yourincome:','s');type=input('yourtaxtype:(1 is for single,2 is for company)','s');ty=(type-1)*2;tyy=ty+4;y=whichstep(income,ty);

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 15:23:28
Matlab 出现的子函数输出问题.源M文件如下:&&&&&&&&&&&&&&&function [taxb,taxa,diff]=homework1income=input('yourincome:','s');type=input('yourtaxtype:(1 is for single,2 is for company)','s');ty=(type-1)*2;tyy=ty+4;y=whichstep(income,ty);
xUn@Q$NS;+de.'Ve՘%BtQ *UT!!!@lA_t/0/MqJY{gl 6l(w>,;Og_=omLO>oLvxsĥALņ^hGx;ǸlTkqJۄͬhEY u5d{ؤg3VL} DN@g'iNz_1B`pC%_Dl9E-^AnMV{)cA}@H,asS_kE<9OqZM3N.(M55x;CYp2<" - Qt0QFMdo:3oI5bAUFƄ, ף/$[0R!He"WCZۆ!6rgXzK&_MAC!д-f5e(*2jQT!yEuzGCYBCUgTթz9Ǹ^;!A g]h+^1< s'M0 - kݜ&KGy 4x qČe`x5Ơq{o)}V5`eMV ,KyIRǏ=6U

Matlab 出现的子函数输出问题.源M文件如下:&&&&&&&&&&&&&&&function [taxb,taxa,diff]=homework1income=input('yourincome:','s');type=input('yourtaxtype:(1 is for single,2 is for company)','s');ty=(type-1)*2;tyy=ty+4;y=whichstep(income,ty);
Matlab 出现的子函数输出问题.
源M文件如下:
&&&&&&&&&&&&&&&
function [taxb,taxa,diff]=homework1
income=input('yourincome:','s');type=input('yourtaxtype:(1 is for single,2 is for company)','s');
ty=(type-1)*2;tyy=ty+4;
y=whichstep(income,ty);yy=whichstep(income,tyy);
taxa=coculate(y,ty,income);taxb=coculate(yy,tyy,income);
diff=taxb-taxa;
printf('diff is tax before cut after');
function y=whichstep(income,t)
[m,n]=which1(t);
rows=size(t);
for k=1:rows
x=m(k);
if income>x
y=x;
end
end
function a=coculate(y,t,income)
[m,n]=which1(t);
for k=1:y
if =y
a=a+(m(k+1)-m(k))*n(k)/100;
else a=a+(income-m(y))*n(y)/100;
end
end
function [m,n]=which1(t)
a=[0,500,2000,5000,20000,40000,60000,80000,100000];
b=[5,10,15,20,25,30,35,40,45];
c=[0,5000,10000,30000,50000];
d=[5,10,20,30,35];
e=[0,1500,4500,20000,40000,60000,80000];
f=[10,20,25,30,35,45];
g=[0,15000,30000,60000,100000];
h=[5,10,20,30,35];
if t==0
m=a ;n=b;
end
if t==2
m=c ;n=d;
end
if t==4
m=e; n=f;
end
if t==6
m=g; n=h;
end
&&&&&&&&&&&&&&&
Error in homework1>which1 (line 30)
a=[0,500,2000,5000,20000,40000,60000,80000,100000];
Output argument "m" (and maybe others) not assigned during call to "D:\homework1.m>which1".

Matlab 出现的子函数输出问题.源M文件如下:&&&&&&&&&&&&&&&function [taxb,taxa,diff]=homework1income=input('yourincome:','s');type=input('yourtaxtype:(1 is for single,2 is for company)','s');ty=(type-1)*2;tyy=ty+4;y=whichstep(income,ty);
% 也可以在 if...end 之外,m = 0; n = 0; 就可以了.