How to do this coding for this equation?

 採用された回答

Walter Roberson
Walter Roberson 2016 年 5 月 1 日

0 投票

syms C t
eqn = i == 25/50001*sin(100*t)+2/100*cos(100*t)+C*exp(-2*t);
eqn0 = subs(eqn,t,0);
solve(eqn0, C)

7 件のコメント

Fairuz Ridwan
Fairuz Ridwan 2016 年 5 月 1 日
Thanks for the help.. But, exactly I have to plot the equation. Haha, I'm not sure how.. Will you help.
Walter Roberson
Walter Roberson 2016 年 5 月 1 日
There is not much to plot. After the substitution of t being 0, you have one equation in one unknown (C), and that has a single solution. Your plot would be at most a single point on the complex plane.
Note: In MATLAB, i represents sqrt(-1)
Fairuz Ridwan
Fairuz Ridwan 2016 年 5 月 15 日
Sorry sir, I have try to plot it but I don't get.. DO you know why?
Walter Roberson
Walter Roberson 2016 年 5 月 15 日
syms C t
t0 = 0;
eqn = i == 25/50001*sin(100*t)+2/100*cos(100*t)+C*exp(-2*t);
eqn0 = subs(eqn,t,t0);
sol = solve(eqn0, C);
plot(real(sol), imag(sol), 'r*')
xlabel('real plane')
ylabel('imaginary plane');
The single red dot that results is the plot. The entire solution to the equation is:
C = - 1/50 + 1i
Fairuz Ridwan
Fairuz Ridwan 2016 年 5 月 16 日
Sorry sir, the real task is I need to plot the equation (i=25/50001*sin100t+2/100*cos100t+Ce^-2t, t=0 ). This equation is the solution for a question. Then, I have to plot it by using matlab, I have try few code but the graph that I got just blank without plot. I'm not sure why because I'm still learning. Thanks for your help sir. If you have any idea?
Walter Roberson
Walter Roberson 2016 年 5 月 16 日
The above code is the solution for that.
Remember, i is the imaginary unit, http://www.mathworks.com/help/matlab/ref/i.html, the square root of negative 1. You have defined a value for the left side of the equation, sqrt(-1), and you have defined a t value, 0. Your equation comes evaluates down to sqrt(-1) = 1/50 + C . There is a single C that solves that equation, C = -1/50 + sqrt(-1) . That leads to a single point on the plot.
Fairuz Ridwan
Fairuz Ridwan 2016 年 5 月 16 日
Oh, I see that's mean C just the constant. Thanks for your help sir. Really appreciate.

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

その他の回答 (1 件)

louis rassinfosse
louis rassinfosse 2016 年 5 月 1 日
編集済み: louis rassinfosse 2016 年 5 月 1 日

0 投票

Try to use the symbolic toolbox;
syms t
I=.....
t=...
And you should get an answer

1 件のコメント

Fairuz Ridwan
Fairuz Ridwan 2016 年 5 月 1 日
I'm blank with the command exactly.. Haha.. btw thanks a lot.

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

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by