Moving a line forward

조회 수: 40 (최근 30일)
Dimo Iordanov
Dimo Iordanov 2021년 2월 15일
댓글: Steven Lord 2024년 2월 7일
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
Jan
Jan 2021년 2월 15일
What is "i" in "for k =i:6"? b is not used anywhere. The loop counter k is not used also. When you speak on an X axis, do you want to create a diagram? What do you call a "new line"?
Please try again to explain, what you want to achieve.
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Rajendra
Rajendra 2024년 2월 7일
creating new files and moving in files to and fro. how it is possible
exampl: Hem/lecture1/test1
Hem/lecture1/test2
Hem/lecture2/test1
mkdir Hem/lecture2/test2
  댓글 수: 1
Steven Lord
Steven Lord 2024년 2월 7일
In the future, if you're asking a question that's not related to an existing question, please ask it as a new question using the Ask link near the top of this page rather than posting it as an answer to that existing question.
See the copyfile and movefile functions.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by