Determine first and second derivatives, without using builtin diff function, using forward differencing with 0 dx error
显示 更早的评论
% Set the range of x values for the function
dx = 0.1;
x = 0:dx:8;
% calculates the value of f using a given function
f = Wave1(x);
% Initialize the derivative vectors as nan arrays the same size as x.
% You must keep the variable names "dfdx" and "d2fdx2"
dfdx =
d2fdx2 =
% Use a loop to find the first derivatives (but not the built in diff() function).
% You may also delete the loop structure beginning and find the derivative using vector operations
for i =
end
% Find the second derivative.
for i =
end
2 个评论
darova
2019-11-20
Where is the problem?
Steven Lord
2019-11-20
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance. The code you've posted so far seems like a framework that your professor has given you where he or she expects you to fill in a few steps.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
采纳的回答
更多回答(1 个)
lilo moutila
2021-1-8
0 个投票
Did you find the loop for this one ?
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!