MATLAB中,已知a,b,c,a:b=c:x,求x,并将d显示到命令行窗口(代码)
时间: 2023-10-07 20:11:00 浏览: 80
关于matlab 命令
根据已知条件,我们可以得到以下等式:
a/b = c/x
将其变形得到:
x = c*b/a
MATLAB代码如下:
```matlab
a = 2;
b = 4;
c = 6;
x = c*b/a;
d = x + 1;
disp(['x = ', num2str(x)]);
disp(['d = ', num2str(d)]);
```
运行结果为:
```
x = 12
d = 13
```
阅读全文