How to write the following equation using matlab
Ältere Kommentare anzeigen
Hi I would like to know how i should write the following equation in matlab. The equation will be used to sketch a graph but the correct graph is not being sketched and i feel like it has something to do with the way I wrote the equation. Could anyone please help me out
Antworten (1)
syms U L C R t
h(t) = 2*sin(sqrt(U*L - C*R^2)/(L*sqrt(2*L))*t) / (sqrt(C)*sqrt(4*L-C*R^2)) * exp(-t*(R/2*L))
Unfortunately you have to look very closely to see that the exponent is negative; I will remind Mathworks again that the negative exponent needs to be more clear.
You would need specific numeric values for C L R U in order to be able to plot this.
7 Kommentare
Walter Roberson
am 22 Sep. 2022
What aspect of this answer did not work for you? I compared the result above to your formula image, and they match exactly -- unless, that is, you have particular reason to want sqrt(L)*L to be expressed in that form instead of the mathematically equivalent L^(3/2)
If you need to plot it at particular given times, then I suggest subs() of the constants into the formula, and then matlabFunction() to generate an anonymous function that you can use to evaluate the formula at particular time.
If you do not need to plot it at particular given times, just a time array, then I suggest subs() of the constants into the formula, and then fplot()
Jadida
am 23 Sep. 2022
As you can easily see from your choice of parameters for R,L and C, the expression 4*L - C*R^2 becomes negative.
R = 10000;
L = 0.01;
C = 0.000000033;
4*L - C*R^2
This means that sqrt(4*L - C*R^2) becomes a complex number.
Further according to your graphics,
exp(-t.*(R/2*L))
should be
exp(-R*t/(2*L))
Jadida
am 24 Sep. 2022
Sam Chak
am 24 Sep. 2022
Jadida, I'd suggest you show us the ordinary differential equation of RLC circuit.
We can probably use dsolve to verify if the analytical solution is the same as the equation provided by you.
Kategorien
Mehr zu Numeric Solvers finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


