Function returning one value
조회 수: 20 (최근 30일)
이전 댓글 표시
clear
clc
close all
x = linspace(-8, 8, 19);
y = (x.*((x.^2)-1)/((x.^2)+1).^2);
figure
plot(x, y)

댓글 수: 0
답변 (1개)
Ameer Hamza
2020년 12월 5일
편집: Ameer Hamza
2020년 12월 5일
You need to use element-wise division
y = (x.*((x.^2)-1)./((x.^2)+1).^2);
%^ put a dot here
Read about element-wise operators here: https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
댓글 수: 2
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!