Differencial equation of eq "without" variables?

1 view (last 30 days)
Good day to all of you,
I would like to ask a question about differencial / derivative (don't know the right "syntax" - not an english native speaking person).
I've got an equation like in this pic: http://imgur.com/xc3fuMT
My problem is that I have to do the Diff Eq of bending curve for my thesis but I don't know how to derive that equation if I know everything in it. even the x1 (which is my derivative parameter) I know. It's [0, 2, 4, 6, 8, .. 200] (for example).
If I do it in my paper, it's easy (as shown in the picture) but I don' know how to do it in matlab.
Can anybody help please?
  3 Comments
Walter Roberson
Walter Roberson on 3 Apr 2013
There is no way to "syms all". However, you can put multiple variables on one "syms" line
syms x1 x2 pqr17
Son Goku ssj4
Son Goku ssj4 on 3 Apr 2013
Edited: Son Goku ssj4 on 3 Apr 2013
That's a shame. So if I want to derive a function and then calculate the derivative, the only process for me is:
1) x = 5 % Need this valus for another calculating
2) eq = x^2 + x - 5 % Evaluate this equation for making a plot
3) syms x % I have to derive so put it as syms
4) eq = x^2 + x - 5 = 0 % Write down once more or just go to step five: eq_D = diff(eq)
5) eq_D = diff(x^2 + x - 5) -> x + 1
6) x = 5
7) eq_D % result for another plot
Or is there some way so that I don't have to put ALL OF MY values as SYMS, --then-- make the diff, --then-- again write values to my variables, --then-- make the result by evaluation?
Consider that I'm using 27 different equations, which every one of them has around 4 variables. So writing: syms F_A F_A1 F_A2 F_A3 F_A4 ... F_C60 is quite a long way to do it. :-)
(I hope it's understandable)
My guess would be something with separate space, but I don't know such a thing yet.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 3 Apr 2013
xvals = 5:.01:7 %for example
syms x
eq = x^2 + x - 5
eq_x = double(subs(eq, x, xvals));
plot(xvals, eq_x);
eq_D = diff(eq, x);
eq_D_x = double( subs(eq_D, x, xvals) );
plot(xvals, eq_D_x);
  1 Comment
Son Goku ssj4
Son Goku ssj4 on 11 Apr 2013
I'm trying to put all of my variables as "sym" /syms in one script.
I thought a way. Witht the function "who" which will write all variables. But...
varibl = who' % this will create vector of variables
for i = 1 : 1 : length(varibl) % i = 1 .. x (x = number of variables)
syms varibl(i) -> I thought it will do syms varibl(1) syms varibl(2) ...
end
but for no avail. It will creaty only syms varibl and syms i
Is there any way to put all variables in syms function with this "solution"?

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!