Animate a movin rectangle car like model
Ältere Kommentare anzeigen
hi
I need to model 3 cars, 2 are not moving and the third should be parked between them. I mean the third one should follow a fifth order polynomial path.
Akzeptierte Antwort
Weitere Antworten (1)
islam dib
am 7 Dez. 2020
0 Stimmen
I got this error !!
Error using +
Matrix dimensions must agree.
Error in Untitled (line 3)
C1 = [0. 0]+C ;
4 Kommentare
KSSV
am 7 Dez. 2020
Show us the whole which shows this error.
islam dib
am 10 Dez. 2020
I ve used this code
L = 1. ; B = 2. ;
C = [0. 0. ; L 0. ; L B ; 0. B; 0 0.] ;
C1 = [0. 0]+C ;
C2 = [0. 5.]+C ;
C3 = [0. 10.]+C ;
path = rand(10,2) ;
for i = 1:10
plot(C1(:,1),C1(:,2),'r')
hold on
plot(C2(:,1)+path(i,1),C2(:,2)+path(i,2),'b')
plot(C3(:,1),C3(:,2),'g')
hold off
axis([-10 10 0 20])
drawnow
pause(0.5)
end
and I got this error
>> plot8cqr
Error using +
Matrix dimensions must agree.
Error in plot8cqr (line 3)
C1 = [0. 0]+C ;
This is not showing any error. It ran sucessfully.
L = 1. ; B = 2. ;
C = [0. 0. ; L 0. ; L B ; 0. B; 0 0.] ;
C1 = [0. 0]+C ;
C2 = [0. 5.]+C ;
C3 = [0. 10.]+C ;
path = rand(10,2) ;
for i = 1:10
plot(C1(:,1),C1(:,2),'r')
hold on
plot(C2(:,1)+path(i,1),C2(:,2)+path(i,2),'b')
plot(C3(:,1),C3(:,2),'g')
hold off
axis([-10 10 0 20])
drawnow
pause(0.5)
end
islam dib
am 13 Dez. 2020
I'm using Matlab 2013b, I think this is the problem, isn't ?
Kategorien
Mehr zu Animation 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!
