フィルターのクリア

Equation plot problem of dy/dx

7 ビュー (過去 30 日間)
buer
buer 2015 年 11 月 24 日
回答済み: Star Strider 2015 年 11 月 24 日
Hi,
I have one problem does not understand. I have an equation for example: Z=A*dB/dt + B*dA/dt . I know A and B, but how can I plot Z? how I can express dA/dt or dB/dt? I tried with diff(A)./diff(t) this give 1 elements less than A. so it make B*dA/dt not possible. can anyone help.
Thanks a lot.

回答 (2 件)

Star Strider
Star Strider 2015 年 11 月 24 日
The gradient function will calculate the first derivative, giving a result the same length as the input vector.
For example:
t = linspace(0, 1);
A = exp(-5*t) .* sin(6*pi*t); % Create Function ‘A’
B = cos(exp(-2*t)*2*pi); % Create Function ‘B’
dAdt = gradient(A,t);
dBdt = gradient(B,t);
Z = A.*dBdt + B.*dAdt;
figure(1)
plot(t, Z)
grid
xlabel('t')
ylabel('Z')

Walter Roberson
Walter Roberson 2015 年 11 月 24 日
Z=A*dB/dt + B*dA/dt needs to be understood in terms of symbolic A and B,
Z = A(t) * diff(B(t),t) + B(t) * diff(A(t),t)
with A(t) and B(t) functions, this is of course the same as
Z = diff( A(t) .* B(t), t)
As they are functions, you need to substitute the formulas for the functions into Z. Then you evaluate the resulting formula over the set of t values that you want to plot at.

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by