Currently i have:
syms x
Y = sqrt ((x^4 - x + 1) / x^4 + x +1 )
I take the derivative of that using diff Y and get one.
The problem I am having is trying to graph the original Y and the diff Y on the same screen. It wont allow me to plot either through the workspace and was wondering if theres a simple command to use to graph them for comparison. Any help would be appreciated thank you!

 採用された回答

Sean de Wolski
Sean de Wolski 2012 年 12 月 12 日

0 投票

You're likely looking for ezplot. Regular plot doesn't play well with syms:
syms x
Y = sin(x);
dY = diff(Y);
ezplot(Y,dY);

3 件のコメント

Frank
Frank 2012 年 12 月 12 日
i tried ezplot(Y,dY) with Y = (x + (x^4 - x + 1)/x^4 + 1)^(1/2) dY = diff(Y)
When plotted all i get is one line so im not sure if thats right or not
Walter Roberson
Walter Roberson 2012 年 12 月 12 日
There is only one variable in the equation; there is no reason to expect more than one line. The line is, though discontinuous at 0.
Frank
Frank 2012 年 12 月 12 日
understood thank you for clarifying!

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 12 月 12 日

0 投票

diff Y
means
diff('Y')
Since the only variable found in that is Y, that means
diff('Y', 'Y')
and the derivative of that is clearly 1.
Perhaps you meant
diff(Y)

2 件のコメント

Frank
Frank 2012 年 12 月 12 日
diff(Y) gives me the right answer thank you but for some reason I cannot plot the ans and the original Y from the workspace. The Error I receive is:
The plot requires the following inputs:A matrix/vector, or 2 vectors/matrices of compatible size, with an optional linespec
Walter Roberson
Walter Roberson 2012 年 12 月 12 日
f = matlabFunction(diff(Y), 'vars', x);
t = linspace(-3,3,100);
plot(t, f(t))

サインインしてコメントする。

カテゴリ

Community Treasure Hunt

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

Start Hunting!

Translated by