Questions tagged [matlab]

Use of Matlab to solve engineering problems.

Filter by
Sorted by
Tagged with
0 votes
1 answer
47 views

simulate a continuous time system in matlab [closed]

I'm trying to simulate a continuous time system but i can't find a solution to this error. I tried many times and can't figure out what is the error in the code. Please help out. ...
  • 11
0 votes
0 answers
32 views

Simulink models comparison issue

I'm comparing two simulink models and in the report i'm getting the following difference. I don't really figure out what that difference is. Any idea is appreciated
-1 votes
2 answers
67 views

How to Determine a Valid Relationship Equation Between Two Finite Datasets -- Python, Matlab or Other [closed]

I struggled to find a clear solution online so I'm resorting to asking a fresh question. I have two finite datasets (call them 40x1 vectors) that are equal in length and generate non-linear curves, ...
0 votes
0 answers
54 views

What is the solutions of the following 1D diffusion equality using Crank–Nicolson method?

Through my research I faced to the following equality and need to find $c_i^{t+1}$. Moreover, I found that it can be solved by Crank–Nicolson method (see here: https://en.wikipedia.org/wiki/Crank%...
0 votes
0 answers
21 views

Structured trianglar finite element mesh in MATALB

The available triangular mesh in the MATLAB PDE tool box here gives an unstructured triangular mesh. How can I get a structured triangular mesh from the tool box with a similar data structure [p,e,t]. ...
  • 101
0 votes
1 answer
43 views

Extraction Flash Calculation - 4 Component and 2 Phase System

I am performing extraction flash calculations for 4 component and 2 phase system in Matlab. For anyone somewhat shaky with what extraction flash calculation is; extraction is performed, feed ...
0 votes
2 answers
73 views

Modeling a second order system in time and frequency domain

For school I was asked to model the transfer function $H(s)=\frac{3}{(s+4)(s+5)}$ in both the time and frequency domains using initial conditions $y(0)=2,y'(0)=3$, a step input, and Simulink. I would ...
  • 3
0 votes
0 answers
50 views

Double Summation of Matrices in Convex Optimization in CVX

I want to implement the following optimization problem from the following paper Randomized Gossip Algorithms, Page 10 Eq. 53\ 1- In this problem, $W$, $P$, and $P_{ij}$ are $n\times{n}$ matrices. I ...
0 votes
1 answer
149 views

Simulink Treating Discrete-Time State-Space as Continuous-Time?

I have a MATLAB script wherein I take a second-order ODE on $\mathbb{R}^3$ (vector field on the phase space), then, at a critical point, take the Jacobian matrix $A$, use a "fully-actuated" ...
0 votes
0 answers
23 views

How do I find the tracking error when simulating spacecraft motion?

I have been studying Control of Nonlinear Spacecraft Attitude Motion and I would like to solve the following question. I have created the following MATLAB code that works for similar questions, but ...
  • 1
0 votes
0 answers
24 views

plotting time delay system eigenvalues

I want to plot eigenvalues of below time-delay system in MATLAB $$\dot x(t)= x(t)-a x(t-T)$$ T is delay what I did until now is first I find the constitutive equation of this system as follow: $$ \...
  • 1
0 votes
0 answers
73 views

Is there a way to output a variable from matlab simulink function block and use it to specify other parameters?

This function block outputs 'phase' which I then want to use as a variable like this: But as you can see simulink throws an error. I tried using Simout but it doesn't work. I am sure I am missing ...
0 votes
1 answer
31 views

"Roll My Own" Integrator Block for Multiple Signals

Is it possible to create a user-defined block in Simulink (and, later, XCos) that accepts a variable number of signals (I anticipate working with mainly 12 signals but not necessarily that number of ...
0 votes
1 answer
60 views

Unstable System. Error Trying to model the Red Bull Stratosphere Free Fall

I tried to model a problem months ago and still I can't solve, I don't want forget this problem so I would like to share what I tried and if you know what is happening with my graph. This is the ...
0 votes
1 answer
118 views

Why matlab returns a damp ratio as 1 for a over damped system?

I have a second order system with the transfer function as: "1/(s^2 + 5.45s + 1)", I thought it should be an over-damped system, but when I use the damp function in MatLab, it returns the ...
  • 57
0 votes
1 answer
196 views

Reject Negative Input Simulink

Note: The design is implemented in Simulink. Suppose I have a system wherein I am computing the sum of errors per discrete time interval. Now, I only want to consider positive errors to be summed up ...
0 votes
0 answers
53 views

How do I find the gain from the root locus with given perfomance, where I know the real part of the poles?

I have an exercise to draw a root locus plot and determine its gain to make sure that it fulfills the performance requirements. the given system G(s) is $$G(s) = \frac{1}{s^2+s}$$ And the given ...
  • 1
1 vote
0 answers
196 views

Errors obtained in the numerical solution of the 1D convection-diffusion equation

I have been trying to solve the 1D convection-diffusion equation In implementing the above, I have tried to follow closely the method described here: https://uk.mathworks.com/support/search.html/...
  • 23
0 votes
2 answers
120 views

Do I need a feedback loop while testing PID controller?

This is a homework for my university course control theory. The task is simple: Test the P, the I and the D controllers separately to see the effect. We don't have to connect the controllers to a ...
  • 344
0 votes
1 answer
711 views

Pole placement with damping ratio and natural frequency

how can I find out the poles of a system if I have the damping ratio $ ζ = 0.707$ and the natural frequency $ω_n = 2.3\text{ rad/sec}$? $A = \begin{bmatrix} -0.02 & 0.1 & 0 & -9.81 \\ -0....
0 votes
0 answers
27 views

Process disturbance in PI controller help

This is the project i'm working on and i'm struggling to understand one sentence which is stopping me from progressing the project. I'm struggling to understand what it means when it says to add +/- ...
0 votes
0 answers
42 views

Mixed Sensitivity Problem

I have plant, $$P(s) = \frac{1-s/5}{(s^2 + s/4 +1/4)}$$ I am taking a mixed sensitivity approach for that I have chosen $V$,$W_1$ and $W_2$ as follows: For bandwidth, $\omega$ =1 so I chose M as, $M = ...
  • 1
1 vote
2 answers
74 views

Fault Recovery of a UAV using MATLAB

I'm currently investigating fault recovery in a UAV using MATLAB. I've been given several variables: phi = the roll angle psi = the yaw/heading angle beta = the side slip p = roll rate r = yaw/...
  • 331
0 votes
1 answer
52 views

How I can separate a matrix into two matrices in Matlab?

I want to separate into two matrices in Matlab like this: $$ Q=Sq^{T}Sq $$ for example this matrix: $$ Q=\Biggm[\matrix{92.316 &31.78&240.417\cr 31.78 &194.66 &275.47\cr 240.417 &...
0 votes
1 answer
55 views

Optimization with GA (genetic algorithm)

I want to optimize the below function with GA(genetic algorithm): $$ \min_{l_{x_1},l_{x_2},l_d}||S_QS(z)||_2 $$ $S_Q$ and S(z) are defined as: $$ S_Q=\Biggm[\matrix{6.6549 &-0.806&6.883\cr -0....
0 votes
0 answers
52 views

Plotting S parameters on Matlab

I have equations for S11 and S21 parameters for a bandpass filter which are obviously frequency dependent. I know there are commands like sparameters() and rfplot() used specifically for plotting S ...
  • 1
0 votes
1 answer
37 views

Why use python over MATLAB? [closed]

So in my bachelors and throughout my engineering degree, we did everything in MATLAB. But I've heard that many companies use python over matlab. Trying Python out for myself, it seems harder to use in ...
  • 3
0 votes
1 answer
49 views

What meaning does the following sine wave have when it comes to amplitude?

So I am getting into engineering and was curious what it means when a sine wave isn't even in a sense, at 0, from my understanding, the waveform has peak to peak amplitude of 4, while having a ...
0 votes
1 answer
45 views

Is more requested MATLAB or Python in companies (for engineers)? [closed]

My question is not exactly on MATLAB vs Python in terms of features (about which there are plenty of topics yet). It's a specific question for engineers who have a certain experience with some ...
  • 111
0 votes
0 answers
73 views

How to model a double transfer function in Simulink?

I'm trying to model an actuator in Simulink based transfer functions previously derived. One of functions is $$\omega_p=G_2(K_cG_1V_c-c)$$ where $$G_1=\frac{K_e}{\tau_es+1}$$ $$G_2=\frac{1}{c+...
1 vote
2 answers
76 views

How do I interpret states in the MATLAB System Identification Toolbox?

I am using the MATLAB System Identification Toolbox to estimate a 3rd order state space plant model. More precisely, the plant is a car with an Arduino mounted on it. The car takes in a PWM duty cycle ...
  • 166
0 votes
2 answers
259 views

How can I find deflection in a member that doesn't have a constant area moment of inertia?

I'm trying to calculate the maximum deflection in a simply supported member with a uniformly distributed load. The trouble is this member does not have a constant area moment of inertia. I've drawn a ...
-1 votes
1 answer
25 views

Regressor-passivity robot control. Help with simulation (Simulink/Matlab)

I'm trying to simulate a 2DOF planar pendulum with a regresor-passivity control, the thing is I've been having some issues with my simulation, I'm using Simulink, but in theory I know my control law ...
-1 votes
1 answer
285 views

sinking speed of particle in water

For a Newtonian fluid the sinking final speed of a metal particle is given by this equation : while g is Gravitational acceleration , $\rho_P$ = is particle density , $\rho_F $ = is fluid density ,...
1 vote
1 answer
337 views

Root Locus and Routh–Hurwitz stability criterion

A satellite launcher has a unit feedback system, whose TF global open loop is given by: $$G_c(s)G(s) = \frac{K(s^2-4s+18)(s+2)}{(s^2-2)(s+12)} $$ a) Draw the root locus for this function b) ...
3 votes
0 answers
69 views

Mathematical transformation of a heading angle to a roll angle

I'm trying to understand a function in a SIMULINK example of a path following UAV simulation. The gist is that, the UAV Waypoint Follower block provides a required heading from a list of waypoints and ...
  • 141
0 votes
1 answer
524 views

How to find closed loop transfer function and use it to identify τ and k?

I have to answer a few questions on transfer functions using Matlab. The first question, which I solved without Matlab, gives a time response graph for an LR circuit, and asks me to find the first ...
  • 11
1 vote
0 answers
29 views

Slow integration of system ODE under specific conditions in adsorption problem

I am trying to solve the system of ODEs below. I am applying the finite differences to z, so I get a system of ODE that I can solve with a solver like ode45. The problem is that under the conditions ...
3 votes
0 answers
79 views

LQR Implementation in MATLAB

I am trying to implement a simple LQR controller in MATLAB for a purely deterministic system. The code is shown below: ...
4 votes
2 answers
323 views

Finding coefficients for a PID controller that minimize the integral of the squared error (ISE)

The problem The problem is to find the coefficients for the P, I and D terms of a PID controller used to regulate the object that minimize the the integral of the squared error (ISE): $$Q = \int_0^\...
-2 votes
1 answer
144 views

Limiting PID controller's output making the plant unstable and untunable

I am using the PID block in Simulink and limiting the output to (+/-)5. The plant becomes unstable and untunable after putting these limits. The plant is stable and tuneable otherwise if no limits are ...
1 vote
1 answer
356 views

How to calculate initial concentration of first-order reaction in CSTR?

(This question comes from a Chemical Engineering background, but basic Math and Programming knowledge is also required. I hope it still falls in the scope of engineering.stackexchange.com If not, ...
  • 111
1 vote
0 answers
10 views

how to implement an encoder in matlab

How can I encode a quantized vector in matlab ? This is a part of a problem where I am asked to implement a communication block using matlab.
1 vote
0 answers
18 views

Unexpected Closed-Loop System Response of Longitudinal Aircraft Dynamics

I have a closed-loop system that represents the longitudinal dynamics of an aircraft with states x velocity, z velocity, pitch rate, pitch, and x and z inertial positions. The outputs of the system (...
3 votes
1 answer
66 views

Problem with performances of a control scheme

I am trying to prove with Matlab that if I have an improper system and I place poles at higher and higher frequencies the performances of the system improves. In particular I am considering the ...
  • 235
0 votes
0 answers
33 views

Matlab Code Debug: Trapezoidal and Simpson's Integration Rule

Hey so I am having issues some issue with this code: ~ ...
0 votes
0 answers
463 views

How to obtain transfer function of servo?

I am using a servo motor and controlling it via arduino. Servo motor is part of a control system and I have to use System Identification techniques in order to obtain the servo's transfer function. ...
0 votes
0 answers
58 views

effect of coupling in MIMO systems

I have a MIMO system with a 2x2 transfer matrix, for example consider: $\begin{pmatrix} \frac{2}{s+1} & \frac{1}{(s+1)(s+2)}\\ \frac{1}{(s+1)(s+2)}&\frac{2}{s+2} \end{pmatrix}$ I would ...
  • 235
0 votes
1 answer
186 views

Solving a linear mass balance equation in the form of Ax = 0 with variables in vector x

I have been tasked with solving a series of linear equations in the form of Ax = b, where b is the zero vector. Specifically, I have a matrix E which is 4x7 and a column vector r which is 7x1, as ...
0 votes
0 answers
48 views

Tool to simulate sensor data

Say I have a light source at a distance of 1Km from a light detector (photo detector). Right in front of the sensor, I keep a rotating reticle with some sort of pattern. To better appreciate the ...