write this following matrix
显示 更早的评论
How can I write the following matrix

I define n=100
And I generate the following code
D= toeplitz ([0 1 zeros(1, n-2) -1]/ (2*h))
but I get wrong matrix. How can I correct it?
6 个评论
Zeynep Toprak
2020-5-7
Sindar
2020-5-7
click the links and read the examples
Sindar
2020-5-7
Also, try this general tutorial: https://www.mathworks.com/learn/tutorials/matlab-onramp.html
I'd been using Matlab for years and still found it useful
Zeynep Toprak
2020-5-7
Gokberk Yildirim
2020-5-16
Actually, it can be done with this Zeynep.
c = [0 -1 zeros(1,n-3)];
r = [0 1 zeros(1,n-3)];
D = toeplitz(c,r) / (2*h)
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!