How to code difference quotients in matlab?
5 次查看(过去 30 天)
显示 更早的评论
I have a vector U and I want to take its difference quotient at a time instance j i.e. I want to find dU as shown below. How can it be done?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1031260/image.png)
Thank you guys in advance!
0 个评论
采纳的回答
Jonas
2022-6-13
elementwise differences of consecutive elements can be calculated using diff() command
2 个评论
Image Analyst
2022-6-14
U = randi(9, 1, 10)
% Compute difference
du = diff(U)
% Compute variance
varU = var(du)
Not sure what you mean by ratio. A ratio is a fraction of something divided by something. What are you ratioing? The ratio of a single number -- the variance -- doesn't make sense.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!