getting this error- "Array indices must be positive integers or logical values"

x = 1:101;
a = 0.1088667334;
Aj= -2.669*10^-4
Bj= 0.73409551
w = Aj((cosh(a*x)-cos(a*x))-(Bj(sinh(a*x)-sin(a*x))))
I am getting this error- "Array indices must be positive integers or logical values"
Is there any solution for this ??

2 个评论

I'm not an expert, but looks like you are trying to index into Aj and Bj with calculated values that are not integers. Both Aj and Bj have just one value assigned to them. What exactly are you trying to assign to the variable w?
yes Aj, Bj and 'a' are constants. 'x' is a varriable. these values are assigned to find the value of W which will be a matrix of 1*101

请先登录,再进行评论。

回答(1 个)

Do you mean to be multiplying these as factors? I can only guess.
x = 1:101;
a = 0.1088667334;
Aj= -2.669*10^-4;
Bj= 0.73409551;
w = Aj*((cosh(a*x)-cos(a*x))-(Bj*(sinh(a*x)-sin(a*x))));

类别

在 帮助中心 和 File Exchange 中查找有关 Numeric Types 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by