matlab中function和end问题,错误提示This statement is not inside any function.(6行代码)function RC = reflect_coeff( ZL,Z0,f )RC = 0.5*abs(ZL-Z0)/sqrt(ZL*Z0)*abs(cos(f*pi/2));endx=0:0.1:5;a=reflect_coeff(100,50,x);plot(x,a,'b-')----------
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/09 08:43:39
matlab中function和end问题,错误提示This statement is not inside any function.(6行代码)function RC = reflect_coeff( ZL,Z0,f )RC = 0.5*abs(ZL-Z0)/sqrt(ZL*Z0)*abs(cos(f*pi/2));endx=0:0.1:5;a=reflect_coeff(100,50,x);plot(x,a,'b-')----------
matlab中function和end问题,错误提示This statement is not inside any function.(6行代码)
function RC = reflect_coeff( ZL,Z0,f )
RC = 0.5*abs(ZL-Z0)/sqrt(ZL*Z0)*abs(cos(f*pi/2));
end
x=0:0.1:5;
a=reflect_coeff(100,50,x);
plot(x,a,'b-')
------------------------------------------------------------------------
>> micro_a
Error:File:micro_a.m Line:5 Column:1
This statement is not inside any function.
(It follows the END that terminates the definition of the function
"reflect_coeff".)
matlab中function和end问题,错误提示This statement is not inside any function.(6行代码)function RC = reflect_coeff( ZL,Z0,f )RC = 0.5*abs(ZL-Z0)/sqrt(ZL*Z0)*abs(cos(f*pi/2));endx=0:0.1:5;a=reflect_coeff(100,50,x);plot(x,a,'b-')----------
可以单独保存1-3行代码后在命令行中运行5-7行代码或改为
function reflect_coeff
x=0:0.1:5;
a=reflect_coeff1(100,50,x);
plot(x,a,'b-')
function RC = reflect_coeff1( ZL,Z0,f )
RC = 0.5*abs(ZL-Z0)/sqrt(ZL*Z0)*abs(cos(f*pi/2));