Community Profile

# Jon

Last seen: 5 jours il y a Actif depuis 2013

#### Content Feed

Afficher par

A répondu
How to run a model in simulink several times like a flowchart
You can use the MATLAB sim command to run Simulink programatically in a loop, please see https://www.mathworks.com/help/simulin...

5 jours il y a | 0

A répondu
Create folders and organize data based on file name.
You should be able to select the ones you want using dir and wildcards so for example list = dir('*CP-B-01*.txt')

9 jours il y a | 0

A répondu
Search for text in all .m files of a folder?
Use the "Find Files" function on the home tab of MATLAB main window

23 jours il y a | 0

| A accepté

A répondu
Minimizing a function using fmincon with special constraints and intervals
Here is one approach % function to be minimized fun = @(x)x(1)^2 + 3*x(2)/x(3) - x(4)^2 ; %initial value x0=ones(1,4); %...

23 jours il y a | 1

| A accepté

A répondu
Get shortest paths and distances among nodes without loop for (and possibly in a faster way)
for the distances (shortest path) between every pair of nodes in the graph d = distances(G) and for some subset, in your case ...

environ un mois il y a | 1

A répondu
Matlab - Class : how to declare an internal function returning a value
You must tell MATLAB that findScenarioNumber is a member function of the class you are currently in scenarioNumber = obj.findSc...

environ un mois il y a | 0

| A accepté

A répondu
any idea how i can compute the elapsed time in each iteration in for loop ?
Use tic and toc

environ un mois il y a | 0

A répondu
Reading a specific file based on the input the user enters
You could do something like this % prompt user for test series number seriesNo = inputdlg('Please enter the test series number...

environ un mois il y a | 0

A répondu
Midpoint between 2 numbers in 2 columns in the same csv file
% read in the data dat1 = readmatrix("File1.csv"); dat2 = readmatrix("File2.csv"); % assume first column matches, and compu...

environ 2 mois il y a | 0

| A accepté

A répondu
How can i plot this: x(t) = |t| * rect((t - 1)/3)
As far as I know, rect is not a MATLAB function. Perhaps it is one you defined and saved in an m file. Assuming this is the case...

environ 2 mois il y a | 0

A répondu
Importing Excel Database Into MATLAB
I just ran T = readtable('dataset2.xlsx') and it seems to import without any problems

environ 2 mois il y a | 0

A répondu
Find the value which is repeated in each row of a matrix (without loop for)
Here's another way % Input A = [ 523 2920 523 1227 8003 8343 5611 8343 ...

environ 2 mois il y a | 1

A répondu
How to discover the neighbor nodes in an matrix?
Here is a little example that I think does what you are asking % % assign threshold for being a neighbor dMax = 0.6; % mak...

environ 2 mois il y a | 0

A répondu
Finding a variable in a large table
Here's a simple example, which I think you could extend to your situation % make an example table name = {'fish','cat','dog','...

environ 2 mois il y a | 0

A répondu
How to build a function to make a working code more flexible?
The first thing you should do to greatly simplify your code and make it more flexible is to avoid using variable names with nume...

environ 2 mois il y a | 0

| A accepté

A répondu
Matlab doesn run the program , says at the editor 'input argument might be unused ' for t
If you have your odefun stored in it's own .m file then the syntax for calling ode45 is just [t,x]=ode45(@odefun,tspan,x0); F...

environ 2 mois il y a | 0

A répondu
I am trying to model solutions to a harmonic oscillator in physics using matlab and get "Array indices must be positive integers or logical values"."
The indices you are using in the expression x_array(t/dt+1) etc are not integers. MATLAB indexes arrays using either integer or...

environ 2 mois il y a | 0

A répondu
Two functions having the same name but one being capital?
While MATLAB is case sensitive, Windows (assuming that is your operating system) is not. Since MATLAB requires that function nam...

environ 2 mois il y a | 0

| A accepté

A répondu
Help to plot a frequency response of a function
Here is a basic approach (not using any toolbox functions for frequency response), that might give you some ideas of how this ca...

environ 2 mois il y a | 1

| A accepté

A répondu
why the coefficient of case 2 is 2 columns, not 5 columns? (about coefficient value of PCA)
By default pca gives the 'economy' option which only includes significant components. for pca(X) with X n by p using 'economy' ...

environ 2 mois il y a | 1

| A accepté

A répondu
How can I generate a pseudo random column vector V
Yes this will make a random column vector of length N at each iteration. The values will be uniformly distributed between 0 and...

environ 2 mois il y a | 0

A répondu
Can someone help me open a Simulink file from an old version of matlab? (probably around year 2000)
I am able to open old Simulink .mdl files from around 1999-2000 using my MATLAB Simulink R2022b without taking any specific acti...

environ 2 mois il y a | 0

A répondu
Saving the timestamp for each iteration in an array
You had numerous errors in your code. A key one is that you were writing the sensor data and time to the same column (B1). Since...

environ 2 mois il y a | 0

A répondu
How to get z transfer function from difference equation?
I don't think there is any direct way to convert a difference equation to a transfer function in MATLAB. Maybe it is possible wi...

2 mois il y a | 1

A répondu
Find the set of eigenvectors of a 4x4 matrix elements whose matrix elements have some VARIABLE PARAMETERS.
If I understand what you are trying to do I think this should do what you want. The resulting values of the eigenvector for eac...

3 mois il y a | 1

A répondu
How can i plot this function? y=0.75/(log10(x)*2).^2
Something like this? x = linspace(1,10); % or whatever interval you would like change accordingly y = 0.75 ./(log10(x).^2).^2 ...

3 mois il y a | 0

A répondu
Why do I receive "Index exceeds the number of array elements. Index must not exceed 7." when trying to remove indices that are followed directly by a zero using a for loop.
Your loop variable x goes from 1 to the length of the vector. In line 4 you try to assign vec(x+1), on the last iteration x = l...

3 mois il y a | 0

A répondu
Only the initial graph shows up
The problem is that you have an error in your line Error using legend Invalid argument. Type 'help legend' for more informatio...

6 mois il y a | 1

| A accepté

A répondu
How to simplify code with multiple variable names?
You can use arrays to hold your data. So one approach would be to use arrays: ma - n by 1 ea - k by n r - n by 1 ir n by 1 ...

6 mois il y a | 0

| A accepté

A répondu
Hello, I need help with: Replace elements in Vector A with those of vector B of the same position, only if they meet a certain condition, otherwise replace by a zero. Thanks
I like @Torsten's one liner and use of the multiplication times the logical zeros to null out the values where B is greater than...

6 mois il y a | 0

| A accepté