Question
I need the answers to be for matlab entry, please. Reminder Every axis should be labeled with title and units. Example solution for Problem 7
I need the answers to be for matlab entry, please.
Reminder
Every axis should be labeled with title and units.
Example solution for Problem 7
n = 100; %assign the number of time steps
lambda = 5;
finalt = 10;
deltat = finalt / n;
t = linspace(0,10,n);[1]
N(1)=100;[2]
for i=1:1:(n-1)[3] %the index of the for-loop must be a variable
N(i+1)=N(i)+deltat*(-1)*lambda*N(i); %finite difference for N(t)
end %for-loop must be ended with an end statement
plot(t,N); %plot results
Explanation:
[1] 0 and 10 mean initial time starts from 0 second and end at 10 seconds. n means there are n partitions in the domain of 0 to 10, which also means there are n+1 nodes from 0 to 10. t is a row vector with n+1 nodes. The time step size is (10-0) / n.
[2] In Matlab, the first element in a Matrix is N (1), not N (0). So the initial condition marks as N (1), not N (0). Before using a matrix, it should be defined. When using a for-loop, we should assign the first element value before the for-loop.
[3] for statement has the following general structure:
for index=expression
statement group
end
Problem 1 Problem 5 plot the function: f( + h* tan as a finction of beta, where h-1. plot the function over-4.1KStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started