# Subscript indices must either be real positive integers or logicals?

1 visualizzazione (ultimi 30 giorni)
Nearlight_lovegym il 4 Mar 2018
Risposto: Ahmet Cecen il 4 Mar 2018
Hello, I'm trying to define the Sherman-Morrison formula:
using the code
invA = A.^(-1)
n=size(A,1)
u=ones(n,1)
Z = 1 + u'*invA*u
inv(A + u*u')=invA - 1/Z * invA * u*u' * invA.
I'm using Z here instead of alpha in the problem. It always returns to an error "Subscript indices must either be real positive integers or logicals". What does it mean? Can somebody help with it??
Matlab new starter here, all help would be appreciated. Thanks heaps!!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Ahmet Cecen il 4 Mar 2018
There is a more fundamental issue here:
inv(A + u*u')=invA - 1/Z * invA * u*u' * invA
The above line indicates that you need to go over some basic MATLAB tutorials. You can't just type and equation with variables on both sides and solve it like you would in Maple or Mathematica. While:
New = inv(A + u*u')
is a perfectly valid line:
inv(A + u*u') = New
is not.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Più risposte (2)

Image Analyst il 4 Mar 2018
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Image Analyst il 4 Mar 2018
This is not proper syntax:
inv(A + u*u') = invA - 1/Z * invA * u*u' * invA
You can't have operations on the left hand side of an equals sign. It can only be a variable that you want to send the right hand side into.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by