Need helping creating and solving for this equation: f(t)=4- t^2 e^(-3t)
2 views (last 30 days)
Show older comments
Write a MATLAB program that will evaluate and plot the function.
for the time range 0 ≤ t ≤ 3 seconds using 100 t values. Use iteration (for loop) and scalar operations to solve this problem.
- allocate space for the time and function vectors
- You can use zeroes function to initialize f and t vectors
- Iterate over indices of t and f vectors to create each value of t, store it in t, calculate f, and store it f.
- Use 2D plot to display the result of t versus f(t)
- Upload code and the display as the submission for the assignment.
3 Comments
James Tursa
on 1 Oct 2020
What have you done so far? What specific problems are you having with your code?
Answers (1)
James Tursa
on 2 Oct 2020
Here is a basic outline to get you started:
n = 100; % Number of elements
t = zeros( you fill this in ); % create an t vector based on n, see doc zeros for the syntax
f = zeros( you fill this in ); % create an f vector the same size as t
for k = something:something <-- you fill in the something based on the size of t
t(k) = something; <-- you fill in the something based on your delta-t spacing
f(k) = something; <-- you fill in the something based on the value of t(k)
end
plot( something ) <-- you fill in the something, see doc plot for the syntax
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!