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 Comments

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

Sign in to comment.

Answers (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))));

Categories

Tags

Asked:

on 27 Mar 2021

Answered:

DGM
on 27 Mar 2021

Community Treasure Hunt

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

Start Hunting!