array errors using n

still new to matlab, so I'm asked to create an array from -5n to 5n with increments of n/100.
im not sure how to properly incorporate n into the array.
Array = [-5n: n/100: 5n]

Respuestas (1)

madhan ravi
madhan ravi el 23 de Jun. de 2020
Editada: madhan ravi el 23 de Jun. de 2020

0 votos

n = 3; % a number
Array = -5*n: n/100: 5*n % you were close
% or perhaps
syms n
Array = -5*n: n/100: 5*n

6 comentarios

Robert Tapia
Robert Tapia el 23 de Jun. de 2020
what if i wasnt given a value for n which is what has me kinda connfused
madhan ravi
madhan ravi el 23 de Jun. de 2020
See my edited answer
Robert Tapia
Robert Tapia el 23 de Jun. de 2020
can you explain what syms does, i havent covered it yet and i also get error 'requires symbolic math toolbox when running it ?
madhan ravi
madhan ravi el 23 de Jun. de 2020
Editada: madhan ravi el 23 de Jun. de 2020
https://www.mathworks.com/help/symbolic/syms.html#description , yes it does require a Symbolic Toolbox, however if your University have access to MATLAB Online , you could try it there.
Robert Tapia
Robert Tapia el 23 de Jun. de 2020
i'm using matlab r2019b thru a remote server
madhan ravi
madhan ravi el 23 de Jun. de 2020
Try this:
Array = @(n) -5*n: n/100: 5*n
If you don’t think this is what you want , nothing in MATLAB can give what you want.

La pregunta está cerrada.

Etiquetas

Preguntada:

el 23 de Jun. de 2020

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by