필터 지우기
필터 지우기

Plot for different value of a

조회 수: 1 (최근 30일)
Atom
Atom 2012년 12월 18일
x = [-2:0.1:2];
z=x.*(a-x^2);
plot(x,z)
I want to plot(x, z) for four values of a = .5, 1, 1.3, 1.95. How to code it without writing same programme for different a four times.

채택된 답변

John Petersen
John Petersen 2012년 12월 18일
편집: John Petersen 2012년 12월 18일
x = [-2:0.1:2];
a = [.5, 1, 1.3, 1.95];
figure;
for i=1:length(a)
z = x.*(a(i)-x.^2);
plot(x,z);hold on;
end
  댓글 수: 1
ABDUL RAZAK BIN NAINA MOHAMED
ABDUL RAZAK BIN NAINA MOHAMED 2019년 9월 29일
how to give different color for each plot for this case

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by