Info
This question is closed. Reopen it to edit or answer.
What's wrong with my code? (first matlab code) picture attached!!
1 view (last 30 days)
Show older comments
I was trying to do an assignment problem using matlab. It's an engineering problem where I had to calculate the drag coefficient, and then use the equation drag=(Cd*r*(V^2)*A)/2 to calculate the drag at different velocities and creating a table. But it gives me an error message as you can see. Can someone please tell me what's wrong with it?
0 Comments
Answers (1)
Star Strider
on 7 Dec 2014
In your ‘Table’ variable assignment, you transposed ‘V’ from a (1x11) row vector to a (11x1) column vector. You cannot horizontally concatenate that with a scalar value for ‘drag’.
This will work:
V = 0:20:200;
r = 1E-6;
A = 1;
Cd = 2.0019E+6;
drag = (Cd*r*(V.^2)*A)/2;
Table = [V' drag'];
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!