Hello I'm trying to model a controls system. The issue I'm having is that the equation of motion and taking the Laplace transform and obtaining the transfer function is computationally difficult. I'm new to this so I don't know which software tools to use. I've heard about Matlab and python. I...
Hello , there is a polarization matix I want to implement in matlab.
I have build a basic matlab plot which could visualize EM waves in 3D.
The basic equations described in equation 2.5.1 from the attached link.
given the simple case of linear polarization, What is the strategy of plotting...
Hello everyone, I am trying to make a state-space observer of inverted pendulum using this code :
and I connect it to this model :
but somehow I am only able to produce this result :
Do you know what is actually wrong with my code?? any response and help is really appreciated..thanks before
Hello all:
i was reviewing matlab related book few days ago , and used Chatgpt to explain a code which was mentioned in the book , chatgpt explained it , but i felt that it assumed that i am sharing the code with it , not posting it for the program to read it and generate an explanation , which...
Hello I want to find distribution of temperature, and stress in cylinder with inner and outer temperature and pressure , I used linear elements with 3 nodes and wrote matlab code, moreover I want to solve that coupled but I have problem in first and last point because those have something like...
Good morning, I have an exercise with two points that gives a Matlab mat file in which are contained the samples of two measured signals and the variable fs indicating the sampling frequency
A)Signal 1 consists of two sinusoidal signals of which you are asked to calculate: -the duration ⇒ I...
Here is my code thus far and it seems to work (I've attached a gif as well so hopefully that works)
va1 = [50*cos(pi/3), 50*sin(pi/3)]; %Two different vectors both starting from the origin
vb1 = [20*cos(pi/6), 20*sin(pi/6)];
iterator = linspace(1,100,100); %100 iterations for the animation...
hello i would like to ask how to write the solution of this matlab program to an audio file using the audio tool box or any other technique. thanks very much.
function chua_oscillator
%This program is computed by S.Sabarathinam
%Based on: Nonlinear Dynamics: Integrability, Chaos and Patterns,by...
Hello everyone,
I have an equation derived as the det of a matrix, which I have solved in Mathematica 11 with Findroot and verified with the respective PhD Thesis' data. However, I now try to get more accustomed to Matlab (R2017b) and hence I tried to reproduce the problem and find its solution...
Hi! I have exam in couple of weeks , and now am looking for sources to learn about dynamic systems , chaotic systems and etc.
My main goal is to learn characteristics of such systems , learn about special points in dynamic plane.
For the most part we used to create dynamic system simulations...
I am using MATLAB to compute a few symbolic derivatives. The outputs are correct (I've checked a few of them) but usually long and never simplified (even when "obvious" simplifications are possible, i.e. combining terms, cancelling things). Is there a way to get MATLAB to simplify symbolic...
The implementations for the two filters in simulink are as follow:
For the first filter:
For the second one:
The obtained results have values of 10^-12, while the expected results should be between 10^-3 - 10.
Since it's the first time when I try t implement a tf with variable coefficients I...
Hello, I am having difficulty converting some MATLAB code to Scilab code. Specifically, the problem is with graphing the results of a spiking neuron program. Herer is the program and the article that explains it:
https://www.izhikevich.org/publications/spikes.pdf
The problem I am having is...
Here is my code so far and solution.
When using fsolve, we obtain the result that the equation does get solved. We find the values to be 1.0000, 0.0000, and 2.0000. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the...
My code is as follows: but when I use the function in my command window exactsol(t) and input a tolerance but there is an error in LINE 19 saying unrecognized ivpfun, could someone help me fix it as I am unsure of how to proceed from here.
function y = exactsol(t)
y = zeros (2,1);
y(1) =...
I got the answer for this question but I was wondering about stepsize when it comes to a problem like this? Is there a way to change the step size? Would my step size change in line 20, or would it change in line 3? I tried changing line 3 to be t=0:100:17.1 but then I get a error message, so...
Apologies for my lack of knowledge on the equations front, I have burnt by brain out on this and haven't the capacity to learn LaTex right now! So here's a screengrab of it:
So, This is a Matlab coursework and I am struggling to work out how best to approach solving it. What I have so far is...
function I=main_simpson(a,b,tol)
f = @(x) sin(1./x);
SO = 0;
N = 10;
S = 1;
while (abs(S-SO)>tol)
SO = S;
h = (b-a)/(2*N);
i = 0:N-1;
xi = a+2*i*h;
xi1 = a+2*(i+0.5)*h;
xi2 = a+2*(i+1)*h;
S = (h/3)*sum(f(xi)+4*f(xi1)+f(xi2));
N = 2*N;
end
end
<Moderator's note...
I am confused why this is the case, why would it output that number? When I go through the code, there is (x+1)-1 which does equal 1, then x = 2*x is 2? So why is the output not 2? How should I proceed in coming up with a solution? Does this have something to do with cancellation errors somewhere?
My code in Matlab for this practice question is:
(
x = linspace(0,4,10);
y = sqrt(x);
plot(x,y,'-o');
hold on
y2=polyfit(x,y,2);
plot(x,y2,'--or')
)
Is this the best way to do? My plots look nearly identical and are on top of one another but a later question asks to graph the error, so I am...
Hello
I wrote a Matlab code to form the 8 by 8 stiffness matrix of a single, 4-noded element, for a plane strain problem for an isotropic element.
I conduct an eigenvalue analysis on this matrix
Matlabe reports 5 non-zero eigenvalue modes, and 3 zero-eigenvalue modes (as expected)
Of the 3...
I am having a bit of trouble understanding what the values of g(x) and h(x) mean. I went through it by hand and here is information that I gathered about the values and questions I am trying to answer to gain a better understanding. Firstly, for the value of x=1e-10 both the numerator of g(x)...
I am confused at how to code this without using any of matlab's already built in functions except for using double. Is this question just asking me to write out the function and then make sure it's double precision?
I have two 1D matrices X(1,j) and Y(1,j) of equal length. To fit Y to a model asin(bx) I tried:
fit = fittype(@(a,b,X), a*sin(b*X));
[fitted, gof] = fit(X, Y, fit)
coefficients = coeffvalues(fitted)
this gives the message: Error using fittype>iDeduceCoefficients
The independent variable x does...
Hi PF!
I typically code in MATLAB. Here, if I run the following program
%% Section 1
x = 5;
y = 2;
%% Section 2
z = x + y;
everything works. But now let's say I wanted to change line 5 to z = x - y. In MATLAB this is simple: I can simply change line 5 and rerun section 2. Is there a way to...
I have a problem with checking angle in phasor diagram. I print my phasor diagram and I don't know how to check angle in window. Have somebody any idea how to search that? Maybe it is not possible and I need to add function in my MATLAB code to get result.
The demo here doesn't specify how to download the file dowPortfolio.xlsx from the first line in the tutorial: T = readtable('dowPortfolio.xlsx');
Any help here (please tell me it's not just me)?
Nevermind, evidently you literally can just copy that line into the command window and MATLAB...
I am studying a flow going through an orifice.
I am aimed at overlapping the plots for the speed distribution over the vertical width profile (which is 0.015 m long; highlighted in red) for two downstream, horizontal distances [w.r.t. the orifice]: 0.01 m and 0.03 m.
The result should look...
I have to use MATLAB to solve the Freidman Equation and I have barely any computer programming language skills whatsoever. Is there anyone that can please help me solve the equation using MATLAB. I desperately need help in this area because my Professor won't show me how like he expects me to...
I have to plot the conductivity dependence of temperature and I have problems with obtaining the right dependency of \mu and n. But let's focus only on carrier concentration first.
For n I used the third equation. From what I understand N_D is a constant. I want my plot to look like this:
But...
Hello !
My name is Amine, Renewable Energies Student (Thermal Conversion Masters degree) .
interested in numerical analysis and applied mathematics .
Currently focusing on Heat and Mass Transfer , Fluid Mechanics and Matlab programming. ready to efficiently help on those subjects
please...
I am performing extraction flash calculations for 4 component and 2 phase system. For anyone somewhat shaky with what extraction flash calculation is; extraction is performed, feed composition is known and we are calculating compositions of both phases at equilibrium, mole fraction of every...
Hello, I am a final year mechanical engineering student designing a heat pump with a linear compressor for an electric vehicle and have decided to model this using Simulink, I would love some help on the governing equations/formulas needed for each component of the heat pump as well as guidance...
Equation:
, where matrix D, C, G and F can be represented by
I'm supposed to design a control system that looks like this:
I am given that the dynamic model = fcn(D,C,G,dq) where the dq is the same as 𝑞̇ and d2q in the diagram is the same 𝑞̈. The default initial value of [𝑞(0), 𝑞̇(0)] is...
I should probably get one or two of these under my belt.
My current need is to plot a ... I guess it's a heat map.
I've got a map of my local area and I want to determine the geographical centre of a number of points (say, seven). So, for every xy "cell" on the map, I'll use pythagoras to...
The method I employed was based on a nested loop. I ran into two issues with this approach
1. The code took way too long to run, easily going for over 7 minutes.
2. In the end, it didn't even completely work, due to the "index exceeding the array length". This confuses me
For the relevant...
First of all, I'm an absolute beginner in MATLAB.
Secondly, I have 2 MATLAB files, one entitled as a "main file" and the other one as a helping .m file, which is called by the main file. I need to run the main file in order to obtain 3 plots. What is the exact procedure that I should follow in...
when I had learned matlab, my professor told me a website where everything is explained about MATLAB variable and MATLAB function. After a long time later, I like to use MATLAB for my work. However, I forget the name of the website. Does anybody tell me the helpful website?
Hello!.
I am new to the forum and I am also a newbie to programming. I want to convert a Mathematica code to Matlab, but I don't understand how to translate these lines. This code is Mathematica 5.0.
defvar := Module[{a},
Clear[ cN, cNf, ginix ];
Clear[ Nh, Nhf, gini ];
cN =...
Hello everyone.
I am currently working with Matlab. I have a 2D gaussian kernel constructed using the muKL technique (first attached figure). I want to use it to generate realizations of a gaussian random process using the KL theorem. For that, I obtain then all eigenvectors and eigenvalues of...
Hi. I am using Matlab to solve ODEs. I use ode45 in a for loop since solving the ODEs in a single ode45 function yielding an error of "out of memory".
However, after the loop has run many times for several hours, the memory will still be full and the program will become slower and slower. If I...
Hello everyone. I am trying to construct a functioning version of randomfields (specifically 2D_karhunen_loeve_identification_example.py) in Matlab. For that, I have to calculate the Karhunen-Loève expansion of 2D data, since this is what it says in the documentation. I also have some sample...
hi guys
I am trying to implement the a second order differential equation tat contains a time dependent term, the equation looks something like
r'' = -\mu/r^3+(g/g^3-m/m^3)
the idea is that i want to calculate 'r' the position vector of a point, that is dependent on vectors g and m, I tired to...
hi guys
i build a little function that outputs a symbolic expression like that below, this is only a part of it:
(105*(x(5)^2/r^2 - 1)^2)/8 + (210*x(5)^2*(x(5)^2/r^2 - 1))/r^2))/(r^2)^(9/2) + (8*R^7*u*x(5)
the problem is the only way to integrate this output is to expand the function externally...
I have this code for 3D band structure of graphene but i can't understand why while graphene first brillouin zone is hexagonal but here a rectangle form of first brillouin zone is used?E0 = 0; % coloumb integral
V = -2.7; % hopping integral [eV]
acc = 1.41; % c-c bond length [Angstrom]
lattice =...
I have a Gaussian shape frequency domain spectrum of which I am calculating the Inverse Fourier transform. I use both IFFT of MATLAB and also an analytical expression of Mathematica. They are not the same.
I don't know where it is wrong. I have pasted both the figures. The numerical one has...
i am new to MATLAB and and as shown below I have a second order differential equation M*u''+K*u=F(t) where M is the mass matrix and K is the stifness matrix and u is the displacement.
and i have to write a code for MATLAB using ODE45 to get a solution for u. there was not so much information on...