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!