Hi @Abdul Hamzah,
After going through your comments,the code you provided for implementing a state-space observer appears to be fundamentally sound; however, there are a few areas to check that may be causing the unexpected output graph.
Observer Gain Matrix (L_mat): Ensure that the poles specified in the op variable are appropriate for your system dynamics. If the poles are too far from the origin, the observer may not converge properly.
State-Space Representation: Verify that the matrices A_new, B_new, C_new, and D_new are correctly defined. The observer's dynamics should be stable, and the dimensions of these matrices must align with the state-space model.
Simulink Model Configuration: Check the configuration of your Simulink model. Ensure that the input signals are correctly connected and that the simulation parameters (like time step and solver) are set appropriately.
Initial Conditions: If the initial conditions for the states are not set correctly, it may lead to unexpected behavior in the output.
Graph Settings: Lastly, ensure that the graph settings in Simulink are configured to display the desired outputs. Sometimes, the wrong signals may be plotted.
By addressing these points, you should be able to identify the issue and achieve the expected results from your state-space observer.
If problems persist, consider simplifying the model to isolate the issue further.
Hope this helps.