![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1624293/image.png)
How can I plot below discriminant functions (g1(x), g2(x), g3(x))?
조회 수: 1 (최근 30일)
이전 댓글 표시
답변 (1개)
Ram
2024년 2월 22일
Hi Rosaline, I understand that you want to plot the above three discrimenant functions.
This is a possible approach, please adject the below limits accoding to your needs;
x = linspace(0, 10);
f = @(x) ((0.5/sqrt(2*pi))*exp(-(x-1).^2/2));
g = @(x) ((0.5/sqrt(2*pi))*exp(-(x+1).^2/2));
h = @(x) ((0.5/sqrt(2*pi))*exp(-(x-1).^2/2) + (0.5/sqrt(2*pi))*exp(-(x+1).^2/2));
figure
plot(x, [f(x); g(x); h(x)])
grid
legend('f(x)','g(x)', 'h(x)', 'Location','best')
Output for above code snippet:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1624293/image.png)
Please also check; https://www.mathworks.com/help/matlab/ref/plot.html.
Hope it's helpful.
-Ram
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!