how to Invert a matrix and how to delete a row and a column?

6 visualizaciones (últimos 30 días)
1.4286 5.0000 Inf 5.0000 3.3333 Inf
5.0000 0.9524 4.0000 10.0000 3.3333 5.0000
Inf 4.0000 1.6393 Inf 3.8462 10.0000
5.0000 10.0000 Inf 1.4286 2.5000 Inf
3.3333 3.3333 3.8462 2.5000 0.6410 3.3333
Inf 5.0000 10.0000 Inf 3.3333 1.6667
I have this matrix but since it contains inf variable i cant invert the matrix....and i get this NaN .....(can i replace inf with zero?)
and how can i delete specific column and row?....

Respuesta aceptada

John D'Errico
John D'Errico el 9 de En. de 2022
You would need to delete almost every row and column. What does it mean to invert a matrix of arbittraily small size then?
And replacing inf with zero is totally inconsistent with what that element was originally, so just repacing infs with zero and still computing an inverse seems wrong. An inf is a immensely large number, as opposed to a really tiny number.
Can you replace an inf with zero? Well, trivially, yes. Read the help for isinf to learn how to locate inf elements.
help isinf
ISINF True for infinite elements. ISINF(X) returns an array that contains 1's where the elements of X are +Inf or -Inf and 0's where they are not. For example, ISINF([pi NaN Inf -Inf]) is [0 0 1 1]. See also ISFINITE, ISNAN. Documentation for isinf doc isinf Other functions named isinf calendarDuration/isinf dlarray/isinf iddata/isinf codistributed/isinf duration/isinf sym/isinf datetime/isinf gpuArray/isinf
Can you delete a row or column of a matrix again, trivially easy. (Should you be reading one of the many MATLAB turorials to be found? Reading the manual is a good thing. Even real men do it.)
A = magic(3)
A = 3×3
8 1 6 3 5 7 4 9 2
A(2,:) = []
A = 2×3
8 1 6 4 9 2

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by