- 1
- 0
- 约8.09千字
- 约 40页
- 2017-05-30 发布于四川
- 举报
系统仿真与MATLAB--广东工业大学自动化学院 第二部分 程序基本流程 Matlab 1 关系运算符和逻辑运算符 运算符 运算 == 等于 ~= 不等于 大于 = 大于或等于 小于 = 小于或等于 逻辑运算符 逻辑与 | 逻辑或 xor 逻辑与或 ~ 逻辑非 2 选择结构(分支语句) disp (This program solves for the roots of a quadratic ); disp (equation of the form A*X^2 + B*X + C = 0.); a = input(Enter the coefficient A: ); b = input(Enter the coefficient B: ); c = input(Enter the coefficient C: ); % Calculate discriminant discriminant = b^2 - 4 * a * c; if discriminant 0 % there are two real roots, so ... x1 = (-b + sqrt(discriminant)) / (2*a); x2 =
原创力文档

文档评论(0)