Questions tagged [matlab]

Use of Matlab to solve engineering problems.

42 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
129 views

dSPACE compiler linker error -- fscanf undefined

I'm dealing with a somewhat intractable problem. We're running dSPACE 7.4 (RTI 1006) on MATLAB 2011a, which I understand uses the dSPACE DS1006 C Compiler v. 2.2. When I try to compile one of our ...
4
votes
0answers
266 views

3 DOF SISO state space control

As part of a control systems course I have to implement control for a 3 DOF SISO mass spring damper model of a robotic cutter arm. The arm is to follow a 5Hz triangle wave reference which is ...
3
votes
0answers
47 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 ...
3
votes
0answers
61 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: ...
3
votes
0answers
63 views

How to solve LMIs with equality constraints using MATLAB?

I would like to find n by n matrices P and Q that minimize J = norm(P) + w*norm(Q), where w is a given weight, subject to P>=0, Q>=0, and f(P,Q)=0, where f(P,Q)=0 is a given function of P and R. I ...
2
votes
0answers
64 views

Maintaining constant speed of a CVT engine during a slope

I am not sure if this question is related to this community. But nevertheless. I work on CVT engines, I had a new idea of modifying my controller during a slope or a gradient on the road so that the ...
2
votes
0answers
37 views

Discretise this transport equation

I am trying to discretise the PDE: $$\phi \frac{\partial c}{\partial t}+\frac{\partial j}{\partial x}=0$$ where $c$ is a function of $x$ and $t$, and $j=qc-D(q)\frac{\partial c}{\partial x}$, $q$ is ...
2
votes
0answers
64 views

calculate output $y(t)$ from $Y(z)$ having discrete closed loop model with sine input - residue method

I have closed loop - discrete model. This is how it looks in matlab: I need to compute analitically output $y(t)$ (same as in the Matlab's scope) having $Y(z)$. Where $Y(z)=U(z)*G(z)$ Input is sine ...
2
votes
0answers
532 views

Export simulink sdi dataset from MATLAB 2015b

I have used the Simulation Data Inspector in Simulink to log a dataset of two time varying signals. The only option I see concerning exporting is to .mat or to workspace, which basically produce the ...
1
vote
0answers
62 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/...
1
vote
0answers
26 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 ...
1
vote
1answer
208 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, ...
1
vote
0answers
9 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
0answers
16 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 (...
1
vote
0answers
31 views

How can I measure the impact of noise on a FFT?

Please, I have to solve a problem and I really need some help. I have to give an efficient method to consider a maximum amplitude as a starting point to consider as noise the whole spectrum below ...
1
vote
0answers
146 views

Designing a PID Controller for Satellite Control

As an Aerospace Engineering Student, I have been trying to make a project of a PID Controller to control the attitude response of a satellite using the parameters from a project called Kufasat. The ...
1
vote
0answers
124 views

Method to simulate a dipole antenna in salt water?

I am looking to simulate the radiation pattern of a 2.7Ghz half-wavelength dipole antenna immersed in salt water. I've been using Altair FEKO software to try and accomplish this. I've tried two ...
1
vote
1answer
562 views

Model Reduction - Export matrices from ANSYS to MATLAB

I am trying to reduce my model in ANSYS using Craig-Bampton Method. My ultimate goal is to read system matrices, stiffness, damping and mass matrix with MATLAB. The size of stiffness matrix that I ...
1
vote
1answer
116 views

simulation of an attitude optimal Backstepping controller based quaternion for a UAV in MATLAB

I'am trying to implement this open access research article Attitude Optimal Backstepping Controller Based Quaternion for a UAV I did not find the same result in this paper Can anyone tell me where my ...
1
vote
0answers
68 views

Temperature distribution

First of all I am just a starter in Matlab, so the program is not optimized. For now I just want to get it running. This is a 3D heat problem with boundary conditions. Fixed temperature from the north,...
1
vote
0answers
41 views

Simulink analysis of data parallel to generation

I would like to simulate the following scenario with Simulink/Matlab(/Stateflow): A random number generator is running. Every 10 seconds the numbers that were generated during the last 10 seconds are ...
1
vote
0answers
25 views

Linear Guidance law into X-Y axis

Im currently writing a model for a guidance law named Maintaining Guidance law. The law looks as following: $$ a_{M} = [K_1,K_2]*[\dot{\lambda_T} ,\dot{\lambda_D}]'$$ Since im using a linear model I ...
0
votes
0answers
19 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: $$ \...
0
votes
0answers
15 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
1answer
25 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
0answers
26 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 ...
0
votes
0answers
22 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
0answers
49 views

Heat Transfer FEA with matlab

I have to write a matlab code using finite element method to solve this problem. I have solved it as follows but I dont know how to apply it in matlab. I have to write a matlab code using finite ...
0
votes
0answers
27 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 = ...
0
votes
0answers
35 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 ...
0
votes
0answers
49 views

Craig Bampton Model Order Reduction on Ansys

I am in the process of modeling a component as a flexible body in Simscape Multibody environment (Simulink). I need to superimpose rigid body model with the deformation model. The deformation model is ...
0
votes
0answers
69 views

Simscape Flexible body - modeling a busbar as a flexible component on Simscape

I am trying to model a copper busbar as a flexible body for simulating it in the Simscape Multibody environment. I have built the model, but I am failing to generate the flexibility. I will describe ...
0
votes
0answers
43 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+...
0
votes
0answers
34 views

How to take the engineering FFT of Signal in Matlab?

All, The FFT function in matlab gives a theoretical mathematical FFT of the signal, and is not scaled to units and is real imaginary and not amplitude-frequency is there an alternative way of FFT to ...
0
votes
0answers
30 views

Matlab Code Debug: Trapezoidal and Simpson's Integration Rule

Hey so I am having issues some issue with this code: ~ ...
0
votes
0answers
373 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
0answers
53 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 ...
0
votes
0answers
33 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 ...
0
votes
0answers
46 views

Solving Hertz Impact ODE with Simulink

I have a question about modelling a nonlinear 2nd order ODE for an impact of a sphere on a thin plate in Simulink. Depending on the solver and solver options, my results in Matlab vary a lot. Some are ...
0
votes
1answer
1k views

Design of a lead compensator with root locus in matlab

For the transfer function $G(s)$, I tried to design a lead compensator for the function to have a response to the step with the following specifications: $$\%OS = 10\% \ \rightarrow \ Overshoot $$ $$ ...
-1
votes
1answer
22 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 ...
-2
votes
1answer
79 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 ...