How to solve this stock market word problem? I have the following problem:
Mr. Fortuna has  $\$100,000$ dollars to invest in stocks, bonds and an account in the money market. Shares have a recovery value of 12% per year, while bonds give 8% a year and the money market account, 4% per annum. They have agreed that the amount invested in the money market must be equal to the sum of 20% of the amount invested in shares and 101010%10% of the investment in bonds. How should you distribute your resources if you need an annual income of $10,000$ for your investments?
More than the solution itself, I want to know how to solve this problem step by step. 
How can I get the correct equations connecting the given information?
 A: Rewriting the original problem:

Mr. Fortuna has $100000$ dollars to invest in stocks, bonds and
an account in the money market.

*

*Shares gives him a return of $12\%$ per year.

*Bonds gives him a return of $8\%$ per year.

*Money Market give him  a return of $4\%$ per year.

And  he decided to allocate his resources in the next way:
"He decided that the amount invested in the money market must be equal to the sum of $20\%$ of the amount invested in shares and $10\%$
of the investment in bonds".
Finally the profit must be $10000$.

You need three variables:
$s$: amount invested in shares
$b$: amount invested in bonds
$m$: amount invested in money market
The allocation constraint is:
$$m=20\%s + 30\% b$$
The profit of each asset is equal to the return multiplied by the amount invested:
$$12\% s + 8\% b + 4 \% m= 10000$$
And finally all the money invested must sum $100000$:
$$s + b + m= 100000$$
A: Suppose a particular lab inverted pendulum has the following state and output equations:
The first two state equations simply define the linear and angular velocity. The third state equation is linear acceleration, and the fourth state equation is angular acceleration. The output equations are fairly trivial and simply show that the outputs to observe are x1 and x2 (that is, the horizontal displacement of the cart, x, and the angle of the arm, θ).
Procedure.

*

*Use MATLAB to find the system eigenvalues to determine if the system shown in (1) is stable or unstable. Think about the answer you are looking for before you do the computation.

*In order to use LQR, we must verify that the system is controllable.  Use MATLAB to do the simple controllability check required.

*This system may or may not be completely observable.  Use MATLAB to do the observability checks (there are two rows in the C matrix so you must do two separate observability checks) to see if it is observable.  If one of the rows of the C matrix indicates that the system is not completely observable, explain why.  Will this affect the use of LQR?  Why or why not?

*Using Fig. 4 as a starting point, construct the system of (1) in Simulink.  Note that subtraction is used for state feedback in the model, so the feedback gains all have signs that are opposite the signs that appear in the A matrix above. The inputs use “+” signs.  For now, a step function input is used to represent F. The scope is used to represent the output, where y1 and y2 have been multiplexed.

Fig. 4.  Start of a Simulink diagram to implement system in (1)


*Double click the integrators for x2, x3, and x4 set their initial conditions to zero.  Arbitrarily set the initial condition for x1 to 1. Double click the step input and set the step time to zero. Also set the final value of the step function 0 (we don’t want any input for now). Set the simulation time to a minimum of 2 seconds and run a simulation. Plot the output. You should see that there are two fixed points, that is, the outputs remain unchanged.

*Set the initial condition of x1 to zero and then set small initial values for each of the other three state integrators, one at a time (keeping the others at zero), doing a simulation run each time (for a minimum of 2 seconds). Is the system stable or unstable? Hint: you are perturbing each state just slightly and you should observe results that correspond to your conclusion in step 1. If you need to run a bit longer than 2 seconds, that’s fine.

*Finally, reset all the state variable initial conditions to zero and set the input to a very small step value, such as 0.01. Run a simulation and plot the output. Is the system stable or unstable?  Repeat for F = - 0.01.

Up to this point, you have experimented with small perturbations to the inverted pendulum system without any control. You should have observed that the system is unstable as originally stated in the beginning. If you have not observed this, recheck your Simulink diagram.  Once you are satisfied with the results, continue with the next step.


*In order to apply LQR, an objective function is required. Suppose you use:

Answer the following questions:
•   What are Q, R and N?
•   What is the significance of the large relative differences among Q11, Q22, and R?
•   Is this a finite or infinite horizon problem?
Now you will find the necessary K feedback gains to minimize (2) using two methods:
a.  Use an appropriate function in MATLAB to find the P matrix. Then use MATLAB to find the K gain vector, with K = -R-1BTP.
b.  Use the "LQR" function in MATLAB to find the K gains directly to verify your results in part 8.a.
Note:  depending on which method you use (a. or b.), the K gains may have opposing signs.  This happens because of the assumption of negative or positive feedback.
9.  Prove that A-BK is now stable by finding the eigenvalues of A-BK. From a traditional control standpoint, what is the significance of these new eigenvalues?
10. Implement the Ki gain values in Simulink by adding the necessary blocks to your existing system. Show a diagram of your final controlled system. Set up several experiments either with the selected initial conditions or with a few different inputs to demonstrate the stability of the controlled system.  Are there any initial conditions or inputs that can cause the system to go unstable?  Why or why not?
