Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
plotting during a for loop
조회 수: 3 (최근 30일)
이전 댓글 표시
So I was able to get my functions working. I have the script file
global X
i=1;
for X=0.001:0.05:0.5;
i=i+1;
sol=fsolve(@CSTReqs,[0,0,0,0,0]);
sel(i)=sol(:,1)
hold on
plot(X,sel(i))
end
I want to plot the first solution, sel(i) as a function of X. However the plot just becomes blank and I don't know why. For every X value I get a number for sel(i). For example for X=0.001, I get sel(2)=0.9999. For X=0.0051, I get sel(3)=0.9955, and so on and so forth, so it works. How do I get the plot to work?
댓글 수: 0
답변 (1개)
Image Analyst
2014년 3월 3일
Try a bigger marker so you can see it easier:
plot(X,sel(i), 'b*-', 'MarkerSize', 15);
Is sel(i) a single number? This line makes me think it might be a vector:
sel(i)=sol(:,1) % Take all rows in column 1 of sol.
Are you sure you don't want to plot the whole thing at once AFTER you finish the loop?
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!