简体   繁体   English

我的八度音程功能出现问题

[英]trouble with my octave function

I think I am missing something very basic here 我想我这里缺少一些非常基本的东西

function F = non_iter(x,kc,kw) 
 F = [x(6)*x(4)*kc-3*x(2);
     x(2)*x(5)-kw*x(6)*x(3);
     x(2)+x(6)-1;
     x(1) -7.52;
     x(6)+2*x(4)+2*x(2)+x(3)-4;
     x(3)+x(5)-8];
end

when I call this, like 当我这样称呼时

fu = non_iter(x,kc,kw)

It says vertical dimension mismatch (3x1 vs 1x2) 表示垂直尺寸不匹配(3x1与1x2)

x is supposed to be a row vector of length 6 and kc and kw are scalars. x应该是长度为6的行向量,并且kc和kw是标量。 I have other functions with vector and scalar arguments but they don't return a column vector. 我还有其他带有向量和标量参数的函数,但它们不返回列向量。

I tried with this function in separate file as well as make it inline with @ operator. 我尝试在单独的文件中使用此功能,并使其与@运算符内联。

This version is working for me on Matlab. 这个版本适合我在Matlab上使用。

function F = non_iter(x,kc,kw) 
 F = [x(6)*x(4)*kc-3*x(2);
     x(2)*x(5)-kw*x(6)*x(3);
     x(2)+x(6)-1;
     x(1)-7.52;
     x(6)+2*x(4)+2*x(2)+x(3)-4;
     x(3)+x(5)-8];
end

In the 4th row of F the white space is treated as a separator for two entries, it should be removed. F的第4行中,空白被视为两个条目的分隔符,应将其删除。 Additionally, there is an unnecessary bracket. 此外,还有一个不必要的括号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM