How to convert symbolic array into a vector
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
SALMAN KHAN
am 6 Sep. 2021
Kommentiert: Star Strider
am 6 Sep. 2021
Using symbolic matlab, when I calculate values of a function f(x) it given me a symbolic array, but I want this in form of a vector so that I can plot L vs x?
x = 0:0.01:1 L = f(2) + df(2)*(x-2)
0 Kommentare
Akzeptierte Antwort
Star Strider
am 6 Sep. 2021
I am not certain what you want to do, or the specific problem.
It might be easiest to create the ‘L’ assignment as a function using matlabFunction, then evaluate it numerically —
syms f(x) df(x) x
f(x) = x^2;
df = diff(f);
L = f(2) + df(2)*(x-2)
Lfcn = matlabFunction(L)
x = linspace(0, 5, 10);
Lval = Lfcn(x)
figure
plot(x, Lval)
grid
Make appropriate changes to get the result you want.
.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!