Why isn't the plot showing up?
조회 수: 3 (최근 30일)
이전 댓글 표시
I'm supposed to have two different figures, one with a resolution of 1, one with a resolution of 0.1. Why aren't the figures showing up? Any suggestions will help.
h = 1; x = 1:h:6; y = (sqrt((x.^4)+1))/(2+sin(x)); figure(1) plot(x,y)
h = .01;
x = 1:h:6;
y = (sqrt((x.^4)+1))/(2+sin(x)); % note that when you change the x vector, you need to recompute the y vect
figure(2)
plot(x,y)
댓글 수: 0
채택된 답변
Star Strider
2016년 1월 25일
When in doubt, vectorise everything to do element-wise operations (unless you know you want to do matrix operations).
This will plot your graph:
h = .01;
x = 1:h:6;
y = (sqrt((x.^4)+1))./(2+sin(x)); % note that when you change the x vector, you need to recompute the y vect
figure(2)
plot(x,y)
Note the element-wise division (./) in your ‘y’ assignment.
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!