Project 1 Base:
Can someone please help me understand what I need from Project 1 Base code to do questions 1 and 2 from the first image? I'm new to MATLAB so a thorough explanation would be great.
This question appears to be off-topic. The users who voted to close gave this specific reason:
For homework questions, the policy is to see some work from the poster. Since you don't know programming, I've outlined what the code is doing, beyond the simple operations (+, -, /, *, ^), to get you started. I think you should be able to implement the models with this information, and I'd be happy to confirm your own answers.
So the best way to figure out what any line of code means, in any language, is to type it and see what happens. To help you get started with programming in MATLAB:
Any text following a % (on the same line) is a comment: it does nothing in the program, and is only there for you to write notes to yourself.
The first two sections, Time-Related Constants and Simulation Constants, are just setting variables. It's like saying x = 3, so that later on you can do other operations with x.
The semicolon at the end of a line (in MATLAB) suppresses the output of the line. See what happens if you type
In iteration constants,
The simulation variables section is creating xyz-matrices, with all values initialized to zero. The length in x is xr_max, and so on. The idea is that, later on, at each step in Euler's method and each value of xr_max and xp_max, you'll save the value of X_rna.
The initial conditions are being set using
For loops, you can read about here, for a start. I do not think understanding this loop requires more information than that page.
Dot before ^2 means that each element of the matrix is being squared; you are not multiplying the matrix by itself.
That should decipher most of the code for you. If you have further questions, feel free to comment here.
EDIT: Question 2 asks you to make a plot. A plot of y vs. x would be made by typing
Also, help on a particular MATLAB function can be accessed by typing
This is a set of ordinary differential equations. Proceed like this
A note on numerical methods for solving ODEs: what you precisely do is add-up and update the rate function in small intervals of time. The very basic method is euler in which you just implement this:
So what you have to do, exactly, is to run a loop which goes from
Within the loop you apply the integration operation.
More advanced techniques use variable step size to improve the performance. You can use the inbuilt ODE solvers if you require better performance and accuracy.
As for your homework.. You already have the code; just need to put the parameters.