How do I fix the plot error for different vector lengths?

This is a homework assignment problem. And I keep getting the error "Error using plot. Vectors must be the same lengths."

 채택된 답변

Walter Roberson
Walter Roberson 2013년 4월 1일

0 개 추천

You start with t(1) and assign up to t(101+1), so your last t is t(102). Your x_exact is caclulated based on your vector of t, so your x_exact is going to be 102 elements long as well. But your t_exact is linspace(1,10,100) so it is going to be 100 elements long.
Hint: if you were to say linspace(0,1,4) then the points generated would be 0, 1/3, 2/3, 1 -- four points because you asked for 4. If you wanted the points distributed (1-0)/4 = 1/4 apart, then you need linspace(0,1,5)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by