how can I plot this exponential function?
조회 수: 1 (최근 30일)
이전 댓글 표시
hi, I have the following function g with the values of x
x = linspace(-2,2)
G = @(x) exp(x) .* (x <= 0) + sin(2*pi*x)./max(x,realmin) .* (x>0);
I tried to plot G using
plot(G,x)
but I am getting error. How can I plot G?
댓글 수: 0
채택된 답변
Star Strider
2018년 4월 9일
Since ‘G’ is a function handle, you cannot plot it.
You need to call it as a function and plot its output, so plot it either as:
plot(G(x), x)
or:
plot(x, G(x))
depending on what you want.
추가 답변 (0개)
참고 항목
카테고리
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!