Why do i keep getting that the inner matrix dimensions must agree? i trying to plot this equation vs time but it keeps giving me this error, even if i use the '.*t' format
Show older comments
q0 = 10;
R = 60;
L = 9;
C = 0.00005;
t = linspace(0.1,0.8,8);
q(t) = (q0)*exp((-R.*t)/(2*L))*cos(sqrt((1/(L*C))-((R/(2*L))^2)).*t);
plot(q(t),t,'-r')
Answers (1)
5 Comments
Jonny Cummings
on 8 Feb 2016
Here is the complete code, with the two changes that I mentioned in my Answer:
q0 = 10;
R = 60;
L = 9;
C = 0.00005;
t = linspace(0.1,0.8,8);
q = (q0)*exp((-R.*t)/(2*L)).*cos(sqrt((1/(L*C))-((R/(2*L))^2)).*t);
plot(q,t,'-r')
it works without error. Whether it is correct is a different matter entirely.
Walter Roberson
on 8 Feb 2016
I copied and pasted your initial assignments and Stephen's version of your q, and that does not give me any error. The end result is a 1 x 8 vector.
Jonny Cummings
on 8 Feb 2016
Stephen23
on 9 Feb 2016
My pleasure. You can also Accept the answer answer that best resolves your question.
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!