Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Hi, so I'm trying to plot this equation: y=-(sqrt(288-2*x.^4))/x with x=0:0.05:3.267 but y is giving me a single answer (-6.55) and when i do plot(x,y) the graph is empty! Can someone help me please!
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, so I'm trying to plot this equation: y=-(sqrt(288-2*x.^4))/x with x=0:0.05:3.267 but y is giving me a single answer (-6.55) and when i do plot(x,y) the graph is empty! Can someone help me please!
댓글 수: 0
답변 (3개)
Ingrid
2016년 2월 29일
you have forgotten to also use the ./ operator instead of the / operator. The code below should give what you try to achieve
x=0:0.05:3.267;
y=-(sqrt(288-2*x.^4))./x;
plot(x,y)
댓글 수: 0
Jos (10584)
2016년 2월 29일
The plot is not empty. It contains 66 points all having the same y value (at y=-6.5514), which can be seen here:
plot(x,y,'bo')
Why is y a scalar? Because, as others told you already, there is a difference between element-wise (.* and ./) and matrix operators (* and /):
x = 1:4
x ./ x
x / x
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!