I get an error and what caused it? - Function Plotting
조회 수: 1 (최근 30일)
이전 댓글 표시
I get an error. What caused it and how do I fix it?
Here my code:
t = -5:0.1:5;
y = ((2.*cos(x)+exp(-0.4.*x))./(0.2.*x+exp(-0.2.*x))) + ((4.*x)./3);
plot(t,y);
Edit: Typo correction.
채택된 답변
KSSV
2022년 1월 6일
Are you looking for this?
x = -5:0.1:5;
y = ((2.*cos(x)+exp(-0.4.*x))./(0.2.*x+exp(-0.2.*x))) + ((4.*x)./3);
plot(x,y);
댓글 수: 4
KSSV
2022년 1월 6일
You can just print the values and see.
a = -5:0.1:5 ; % this creates numbers between -5 and 5 with step size 0.1
diff(a)
Also have a look on linspace.
b = linspace(-5,5,5)
If you want 5 as the step/ difference. YEs use:
c = -5:5:5
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!