Moving a line forward

13 ビュー (過去 30 日間)
Dimo Iordanov
Dimo Iordanov 2021 年 2 月 15 日
コメント済み: Dimo Iordanov 2021 年 2 月 22 日
Hello,
I am sorry for the quite general quesion, but I am having issues with making any of my things work. I need to create a moving front so that when I start from one point, or a line, I can start moving that line forward, by some ammount in the x axis and plot the new line.
  1. I tried a for loop that should create a new line, and colour the new area starting from the initial line. I tried this with this code, but it didnt work.
a = 1;
c = 2;
b = [ 0 , 0];
%Create Initial Straight line
for k =i:6
a1(i) = a+1;
c1(i) = c+1;
d = [a1; c1];
end
  1. Create some sort of difusiuon algorithm that simulates the same thing again.
  2 件のコメント
Dimo Iordanov
Dimo Iordanov 2021 年 2 月 22 日
Thanks a lot this is what I needed.

サインインしてコメントする。

採用された回答

Reshma Nerella
Reshma Nerella 2021 年 2 月 18 日
Hi,
From my understanding, you want to plot a line, and then move it some units with respect to x axis and plot it.
You can drawnow function
For example, you have a plot
x = 1:5;
y = 1:5;
plot(x,y);
Now you want to shift the line by 3 units from x axis
y =y+3;
plot(x,y);
drawnow
It will update the figure with the new plot
For more information and examples, refer to the documentation page.
  1 件のコメント
Dimo Iordanov
Dimo Iordanov 2021 年 2 月 22 日
Thanks a lot this is what I needed.

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by