Plotting a function with a range of values

조회 수: 10 (최근 30일)
tsmart15
tsmart15 2018년 10월 2일
댓글: tsmart15 2018년 10월 3일
I have coded a function, f(x). For any input, x, my function works correctly. However, when I try to insert a range of x (i.e. x = -10:10), the function doesn't work. There is no error. The output values are just incorrect. Has anyone had this happen to them? Any suggestions on how to fix this issue?

채택된 답변

KSSV
KSSV 2018년 10월 3일
I assume...you need to include the element by element operations of MATLAB. Like .* and .^. When you have array, you need to follow up the element by element operations. Read more here: https://in.mathworks.com/help/fixedpoint/ref/times.html
If the error is not due to above reasons. YOu need to show us the code.
  댓글 수: 3
KSSV
KSSV 2018년 10월 3일
What was the issue?
tsmart15
tsmart15 2018년 10월 3일
I forced the input to accept arrays, which allowed for the range of values for x and individual values for x.

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by