0

i have a list of functions:

[ x - 3^(1/2)/2, x - 4967757600021511/81129638414606681695789005144064, x + 3^(1/2)/2, x - 4160783518353059/4503599627370496, x - 1723452963400281/4503599627370496, x + 3446905926800561/9007199254740992, x + 4160783518353059/4503599627370496, x - 8566355544790271/9007199254740992, x - 2647149443198255/4503599627370496, x - 4967757600021511/81129638414606681695789005144064, x + 5294298886396509/9007199254740992, x + 8566355544790271/9007199254740992, x - 8700286382685973/9007199254740992, x - 2^(1/2)/2, x - 291404338770025/1125899906842624, x + 2331234710160199/9007199254740992, x + 2^(1/2)/2, x + 2175071595671493/2251799813685248, x - 8781369964030313/9007199254740992, x - 7042111946219083/9007199254740992, x - 3908077291623905/9007199254740992, x - 4967757600021511/81129638414606681695789005144064, x + 122127415363247/281474976710656, x + 880263993277385/1125899906842624, x + 4390684982015157/4503599627370496]

and I would like to plot the functions with this command "plot(funciones_che(1))" but when I make the plot throws me the following error:

Error using plot. A numeric or double convertible argument is expected

I have also tried x = -10: 10 and plot (x, funciones_che (1)) but I get the same error

1 Answer 1

1

You do not have a vector of functions. The variable funciones_che is just a long concatenated sequence of numbers. If you run size(funciones_che), you should get 1 x m*n where m is length(x) and n is the number of "functions" you have. Having a true vector of functions would actually complicate your life unnecessarily.

If you have a symbolic expression somewhere along the line, it may be a bit difficult to clear: http://www.mathworks.com/help/symbolic/clear-assumptions-and-reset-the-symbolic-engine.html. My recommendation is to reset the entire symbolic engine with all its assumptions just to be safe: reset(symengine).

MATLAB is very good at plotting matrices like the one you have, but the size has to be right:

  1. Separate your plots with semi-colons (;) rather than commas (,):

    funciones_che=[ x - 3^(1/2)/2; x - 4967757600021511/81129638414606681695789005144064; x + 3^(1/2)/2; .....]
    

    Now size(funciones_che) will be n x m.

  2. Transpose the matrix (to make plot interpret it correctly):

    funciones_che = funciones_che';
    

    Now size(funciones_che) will be m x n.

Plot as you wanted to: plot(funciones_che(:, 1)) for the first vector, or plot(funciones_che) to put all of them on the same plot. If you are not interested in the second version, you do not have to transpose the matrix. If you do not transpose the matrix, plot using plot(funciones_che(1, :)) instead.

Final point: you do need to initialize x, for example to -10:10 as you tried.

Sign up to request clarification or add additional context in comments.

11 Comments

Thanks for answer, but gives me the same error. Error using plot. A numeric or double convertible argument is expected
How do you define x?
I define it as: x=-10:10;
Run clear x funciones_che, then x=-10:10; funciones_che=...; again.
You may have overwritten some variables with values of a weird type elsewhere
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.