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.

I need the answers to be for matlab entry, please. Reminder Every

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.1K

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!