Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Did you know you can set a signature that will be added to all your posts? Set it here!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Feb 18, 2022
09:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Feb 18, 2022
09:39 AM

iterative calculation

```
Hello everyone!
I need your help.
I can't understand why the program doesn't continue to calculate.
It says the value of must be a vector.
```

Please look at the attached file!

Greetings from Germany

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Feb 18, 2022
12:52 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Feb 18, 2022
12:52 PM

You've probably reached a point where alpha is outside of the range 20...1200. In that case your function SW(alpha) returns a NaN, which is NOT an array, so Ca(alpha), that tries to get the first element of SW(alpha) runs into this problem.

Note that it is not necessary to have SW(alpha) return 1-element vectors. I suspect you've typed square brackets around the expressions inside SW(alpha). You should never do that unless you explicitly want to produce a vector.

I suggest you change SW(alpha) to NOT use square brackets, and omit the transpose operator, like this:

Then you're rid of the 'this should be a vector' error. In return you may have to deal with the fact that you are running into a NaN, which will cause NaN's to appear in the results of the Theta.at4 function.

Success!

Luc

3 REPLIES 3

Feb 18, 2022
12:52 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Feb 18, 2022
12:52 PM

You've probably reached a point where alpha is outside of the range 20...1200. In that case your function SW(alpha) returns a NaN, which is NOT an array, so Ca(alpha), that tries to get the first element of SW(alpha) runs into this problem.

Note that it is not necessary to have SW(alpha) return 1-element vectors. I suspect you've typed square brackets around the expressions inside SW(alpha). You should never do that unless you explicitly want to produce a vector.

I suggest you change SW(alpha) to NOT use square brackets, and omit the transpose operator, like this:

Then you're rid of the 'this should be a vector' error. In return you may have to deal with the fact that you are running into a NaN, which will cause NaN's to appear in the results of the Theta.at4 function.

Success!

Luc

Feb 19, 2022
08:13 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Feb 19, 2022
08:13 AM

Thanks! It works like butter 🤗

Feb 18, 2022
12:56 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Feb 18, 2022
12:56 PM

I haven't got Prime Subscription, only Express, so I can't check.

However, have you tried using a try-catch expression to look at what Ca is returning and the associated value of theta_a.t? I notice that Ca returns NaN if alpha is out of bounds, and NaN[0 gives that error message.

Stuart