试题详情
简答题 利用函数文件,实现直角坐标(x,y)与极坐标(ρ,θ)之间的转换。已知极坐标的矢径、极角分别为:
  • 函数文件:
    文件名:transform
    程序:
    function[r,theta]=transform(x,y)
    r=sqrt(x*x+y*y);
    theta=atan(y/x);
    函数调用:
    程序:
    x=input(’Pleaseinputx=:’);
    y=input(’Pleaseinputy=:’);
    [r,theta]=transform(x,y);
    disp([’矢径r为:’,num2str(r),’’,’极角theta为:’,num2str(theta)])
  • 关注下方微信公众号,在线模考后查看

热门试题