首页 > 解决方案 > 使用存储在变量 Matlab 中的方程

问题描述

我想使用一个使用内联函数存储在变量中的方程,但我收到错误“检查不正确的参数数据类型或在调用函数‘coeffs’时缺少参数。'。这是我想要的代码和输出。MATLAB

syms x;
eq = input('Enter Equation Of Divisor: ','s');
p = inline(eq);
c = coeffs(p);
disp(c);
> Enter Equation: x-4
> [-4,1]

谢谢。

标签: matlabprintfequationcoefficients

解决方案


使用以下代码:

syms x
eq = input('Enter Equation Of Divisor: ');
c = coeffs(eq);
disp(c)

推荐阅读