matlab - 我可以将包含多个变量的函数存储在 cellfun 中,仍然可以单独使用吗?
问题描述
我是matlab的新手,它是否能够存储包括多个变量的函数仍然可以使用?是否能够得到与下面相同的结果?
%example
f=sin(x*t+theta); % function I used
x=[1 2 3 4 5 6 7 8 9 10]; % spactial distribution % will remain unchange in for loop
t=[1 2 3 4 5]; % time
theta=[1 2 3 4 5]; % phase change by time (will be same length as time)
first, I would like to do something to this function to made it :
F=[ sin(x*t+1) sin(x*t+2) sin(x*t+3) sin(x*t+4) sin(x*t+5)];
所以我可以调用函数,例如: F{1}=sin(x*t+1) 接下来,F中的函数需要按时间一起移动:
for b=1:length(theta) % F{1},F{2},F{3},F{4},F{5}
for a=1:length(t) % time change
A=F{b}(a); % (a) is suppose to be the time change, but I don't know how to do with it
end
end
波函数最后会在我的代码中计时一个阶跃函数,所以我不能改变我的代码的顺序,它需要像这样一步一步地进行。t和theta的长度会大于1000,所以无法一一键入函数。
解决方案
推荐阅读
- yugabyte-db - 主引导过程如何工作以及如何调试它?
- php - 如何使用 where 子句在 cakephp 中正确嵌套查询?
- reactjs - 从 yarn build 编辑静态文件(index.html)
- python - jupyter nbconvert:如何在不执行多次的情况下执行和输出多种格式?
- capacitor - “无法注入电容器”是什么意思,我该如何解决?
- python-3.x - 进行数字更改时,python多线程锁无法按预期工作
- javascript - Javascript Promise:为什么即使返回命令在函数内部,我也必须返回函数?
- javascript - 停止字符被插入输入反应
- sql - 将 varbinary 值转换为字符串以获得相同的值
- .net - 如何在 Windows 窗体中添加像 WPF 的 WindowStyle.None 这样的调整大小边框?