0

我有一个名为 motor_model.m 的 m 文件。我有另一个名为 controller.m 的 m 文件,我在第一行调用 motor_model.m。现在 motor_model.m 的输出是稳态电流,它存储在一个名为 I_steadystate 的变量中,该变量的值需要在 controller.m 中调用。

你能给我关于如何做到这一点的代码吗?

4

1 回答 1

0

在 m 文件 controller.m 中:

function [] = controller()
steadyState = motor_model()

在 m 文件 motor_model.m 中

function [I_steadystate] = motor_model()
I_steadystate = 0; % 0 is an example. I_steadyState should be defined somewhere in your code.
于 2013-03-27T18:14:25.023 回答