Category "matlab"

Motion compensation in MATLAB

I'm working on some Matlab code that would compare the prediction error between two video frames with and without motion compensation. I've already figured out

MATLAB ode45. Trouble with function handle @ when setting up equations for ode45

Having trouble in using a random white noise in ode45 function handle input. I am using ode45 function to solve a 2 degree of freedom mechanical system (spring/

Function handle as input to the function handle

Is it possible in Matlab to create function handle that will take as input another function handle and how? e.g. I have h = @(x) x^2 I want to have h as paramet

Matlab new C++ MEX function runnign speed vs C Mex interfaces

Recently I am working on boosting Matlab project performances. As you may know, Matlab 2017 introduced a new C++ Mex function to avoid unnecessary data copies,

Implementing loss function in MatConvNet

I am trying to implement code for this loss function for a classification task for a subset image data using several pre-trained models provided by MatConvNet b

How to make two markers share same label in Matlab plots

I am building a MATLAB script to add two markers for a single label similar to below in Python. How to create two legend objects for a single plot instance? and

Why does the y-axis have to be flipped for a cwt analysis in Python to compare to the Matlab cwt function

For the audio file found here, I am using the ssqueezepy library in Python to generate the cwt of the signal. Here is my Python code: import librosa import lib

Axis scale for a pdf plot

I have a bunch of data which are distributed as a pdf function. When I plot the histogram histogram(mydata, nbin, "Normalization", 'pdf') the y-axis has a scale

Is there a way to plot a line of best fit through the origin in MATLAB

I am currently working on an engineering project and have to use complex numbers. I want to take the complex numbers, plot the real and imaginary parts of them,

Arnoldi algorithm in Matlab

function [V,H] = Arnoldi(A,v,m) [n,~] = size(A); V = zeros(n,m+1); H = zeros(n,n); V(:,1) = v/norm(v); for k = 2:m V(:,k) = A*V(:,k-1); for j = 1:(k-

Multiple custom graphics object inheriting from ChartContainer

I am trying to write a custom chart (or graphical object, rather), and I would like to plot several of them in a single figure. I am following this guide, but I

save multi-outcomes-variables using iteration in matlab

I want to build a loop in Matlab where 'i' is the iteration variable and for each 'i' an n*n matrix will be the outcome. my question is how can I tell the progr

How to sum functions in MATLAB under a condition

I'm trying to write a function that sums a bunch of functions and I have no idea what I'm doing wrong. My code: function [f_max,x_max] = ftot(l,a,E,J,F) % a and

Plot two-dimensional array as elliptical orbit

I am attempting to plot an elliptical orbit based on a 2-D position array, beginning at p= [5 0]. The plot charts positions from a timeframe t, here between 0 a

Earthquake simulation - finite elements method (Matlab)

do you know is there's a way to simulate a earthquake with the finite elements method using the Partial Differential Equation Toolbox on Matlab ? My goal is to

hydrological model of a river basin, forecasting precipitation cumulative 5 days inflow [closed]

Hi guys we are trying to find the best proper model to forecast 5 days inflow cumulative of a river basin. For hydropower puroposes and water

Simplification code to avoid if else division problem

I would like to make an optimisation by avoiding to use theIf else i used this element because when E = 0in the logic of my probelm B = [0 0 0 0 0]. By consequ

Matlab resample array based on second array

Let's say I have two datasets, both consisting of an x and y array, e.g.: x_1 = [1 2 3 4 5 6 7 8 9 10]; y_1 = [8 12 20 3 4 9 10 55 3 2]; x_2 = [2 5 6 8 9]; y_2

MATLAB resolution of a 6-th order non-linear differential equation [stiffness]

I am currently trying to solve a non-linear differential equation of order 6 for a function F defined on : Or : With these following boundary conditions : An

Matrix index out of range during loop

a is an nxn matrix. I have this code: [m,n] = size(a); x = zeros(m,1); for j=1:1:n if(j==1) a(1,:) = []; else end disp(a); a(:,j) =