How to convert ANS to MATRIX?

4 visualizaciones (últimos 30 días)
D Dwiz
D Dwiz el 9 de Mzo. de 2017
Comentada: Adam el 9 de Mzo. de 2017
I got following:
x = [0:119] (enter) & then, y = x/120
Now I've all values of 'y'. for further calculation like (1-y)^2 matlab is asking to convert 'y' into matrix form and data in scalar form.
Error message is showing : "Error using ^ Inputs must be a scalar and a square matrix. To compute elementwise POWER, use POWER (.^) instead."
Can you help me out here to convert all data of 'y' in form of matrix? & whatever more you want to add...

Respuesta aceptada

Adam
Adam el 9 de Mzo. de 2017
"To compute elementwise POWER, use POWER (.^) instead"
result = ( 1 - y ).^2
  2 comentarios
D Dwiz
D Dwiz el 9 de Mzo. de 2017
Thanks, But before doing that I needed to convert 'y' in form of matrix by using..... y = vec2mat(y,1)
Adam
Adam el 9 de Mzo. de 2017
y should already be an array of length 120. This is fine as it is, it doesn't need converting to anything else. vec2mat does not exist as a function in my Matlab or toolboxes so I don't know what it does off-hand.

Iniciar sesión para comentar.

Más respuestas (1)

D Dwiz
D Dwiz el 9 de Mzo. de 2017
Converted y into matrix by ( y = vec2mat(y,1) ) then (1-y).^2

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by