Suspensa Vix Via Fit

Answered

Inputting the function Sin(2x)Cos^2(0.5x)

x = linspace(0,2*pi,50); y = sin(2*x).*cos(0.5*x).^2; plot(x,y)

Inputting the function Sin(2x)Cos^2(0.5x)

x = linspace(0,2*pi,50); y = sin(2*x).*cos(0.5*x).^2; plot(x,y)

7 hours ago | 0

Answered

Plot a variable within a function

"How should I plot Ca vs W curve after function has been evaluated" Return the required variables as the 2nd, 3rd, etc. functio...

Plot a variable within a function

"How should I plot Ca vs W curve after function has been evaluated" Return the required variables as the 2nd, 3rd, etc. functio...

8 hours ago | 0

Answered

Invalid data type - converting to cell array to run functions

In both cases your code nests a cell array inside a cell array: dff{i} = num2cell(tot_dff(1,f_i(i):f_o(i))); % ^^^^^^...

Invalid data type - converting to cell array to run functions

In both cases your code nests a cell array inside a cell array: dff{i} = num2cell(tot_dff(1,f_i(i):f_o(i))); % ^^^^^^...

8 hours ago | 1

| accepted

Answered

Using an integral in a function

The problem is that in the "main file" you did not declare q_Max and f_1 as global. But rather than using global variables (whi...

Using an integral in a function

The problem is that in the "main file" you did not declare q_Max and f_1 as global. But rather than using global variables (whi...

13 hours ago | 0

Answered

Doubt about plotting in Matlab and finding intersect points

"...if I plot the circle with the lines, the circle deforms to an oval" axis('equal') https://www.mathworks.com/help/matlab/re...

Doubt about plotting in Matlab and finding intersect points

"...if I plot the circle with the lines, the circle deforms to an oval" axis('equal') https://www.mathworks.com/help/matlab/re...

14 hours ago | 0

| accepted

Answered

I am trying to write a recursive code to check whether a string is palindrome or not, when i am running a trial case a error message shows up stating "he function call palindrome('madam') caused an error and did not complete (MATLAB:TooManyOutputs)".

If you want to return an output argument then it must be declared in the function, e.g.: function out = palindrome(v) if l...

I am trying to write a recursive code to check whether a string is palindrome or not, when i am running a trial case a error message shows up stating "he function call palindrome('madam') caused an error and did not complete (MATLAB:TooManyOutputs)".

If you want to return an output argument then it must be declared in the function, e.g.: function out = palindrome(v) if l...

1 day ago | 0

Answered

how to load saved workspace in a custom named variable?

The efficient approach is to use indexing (rather than anti-pattern dynamic variable names): https://www.mathworks.com/help/mat...

how to load saved workspace in a custom named variable?

The efficient approach is to use indexing (rather than anti-pattern dynamic variable names): https://www.mathworks.com/help/mat...

1 day ago | 1

| accepted

Answered

converting abbreviation of months to numerical value

ismember makes this easy: >> D = {'mar','apr','nov','may'}; % your data >> C = {'jan','feb','mar','apr','may','jun','jul','aug...

converting abbreviation of months to numerical value

ismember makes this easy: >> D = {'mar','apr','nov','may'}; % your data >> C = {'jan','feb','mar','apr','may','jun','jul','aug...

1 day ago | 0

Answered

how do I create a loop for to extract doubles variables from a cell array?

Where raster_data is your cell array: for k = 1:numel(filenames) raster_labels = raster_data{k}; ... the rest of your...

how do I create a loop for to extract doubles variables from a cell array?

Where raster_data is your cell array: for k = 1:numel(filenames) raster_labels = raster_data{k}; ... the rest of your...

1 day ago | 0

Answered

Extracting data from a table that has cells in cells

>> S(1).date = '20200120'; >> S(2).date = '20200120'; >> S(1).id = 1; >> S(2).id = 2; >> S(1).action = [0;0;0;1;0]; >> S(2)...

Extracting data from a table that has cells in cells

>> S(1).date = '20200120'; >> S(2).date = '20200120'; >> S(1).id = 1; >> S(2).id = 2; >> S(1).action = [0;0;0;1;0]; >> S(2)...

1 day ago | 1

| accepted

Answered

Split array of sensor data by indexing

S = load('matlab.mat'); T = S.Data.IMU; G = findgroups(T.name); C = arrayfun(@(g)T(g==G,:),1:max(G),'uni',0); You can then t...

Split array of sensor data by indexing

S = load('matlab.mat'); T = S.Data.IMU; G = findgroups(T.name); C = arrayfun(@(g)T(g==G,:),1:max(G),'uni',0); You can then t...

1 day ago | 1

| accepted

Answered

What code is it?

"Is there someone recognize the following code..." It isn't code, it is a binary .mat file (just as the text at the start of th...

What code is it?

"Is there someone recognize the following code..." It isn't code, it is a binary .mat file (just as the text at the start of th...

1 day ago | 0

Answered

store for loop outcomes in matrix

With MATLAB it is generally much better to loop over indices (rather than over data values), then you can simply use those indic...

store for loop outcomes in matrix

With MATLAB it is generally much better to loop over indices (rather than over data values), then you can simply use those indic...

1 day ago | 0

| accepted

Answered

Importing and Organizing Text File Data

This efficiently reads all of the file data into one structure. [fid,msg] = fopen('Example_File.txt','rt'); assert(fid>=3,msg...

Importing and Organizing Text File Data

This efficiently reads all of the file data into one structure. [fid,msg] = fopen('Example_File.txt','rt'); assert(fid>=3,msg...

1 day ago | 0

| accepted

Answered

Variable 'KD' is not fully defined on some execution paths

Look at this line of code KD_anterior=KD; and now consider what is the value of KD the second time the function is called. The...

Variable 'KD' is not fully defined on some execution paths

Look at this line of code KD_anterior=KD; and now consider what is the value of KD the second time the function is called. The...

2 days ago | 0

Answered

How to select or group sections of an array without using indexing

>> A = [NaN, NaN, NaN, NaN, 2, 3, 6, 7, NaN, NaN, NaN, NaN, NaN, 4, 6, 8, 8, NaN, NaN, NaN, NaN]; >> X = diff([true,isnan(A),tr...

How to select or group sections of an array without using indexing

>> A = [NaN, NaN, NaN, NaN, 2, 3, 6, 7, NaN, NaN, NaN, NaN, NaN, 4, 6, 8, 8, NaN, NaN, NaN, NaN]; >> X = diff([true,isnan(A),tr...

2 days ago | 0

| accepted

Answered

Assign values of .mat files into matrix

D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'silomodresults*.mat')); C = {}; for k = 1:numel(S) ...

Assign values of .mat files into matrix

D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'silomodresults*.mat')); C = {}; for k = 1:numel(S) ...

2 days ago | 0

| accepted

Answered

Splitting an array up

Just use mat2cell, no need for reshape: >> M = rand(64,92690); % fake data >> N = 2048; >> S = size(M); >> V = repmat(N,1,fi...

Splitting an array up

Just use mat2cell, no need for reshape: >> M = rand(64,92690); % fake data >> N = 2048; >> S = size(M); >> V = repmat(N,1,fi...

2 days ago | 2

Answered

Subtraction inside a cell array

You will have to get the numeric data out of the cell array before performing any numeric operations on it. Although you did no...

Subtraction inside a cell array

You will have to get the numeric data out of the cell array before performing any numeric operations on it. Although you did no...

3 days ago | 0

Answered

How to combine the multiple .mat files of ecg to get a single file.

This should get you started: D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'*.mat')); for k = 1:nume...

How to combine the multiple .mat files of ecg to get a single file.

This should get you started: D = 'path to the folder where the files are saved'; S = dir(fullfile(D,'*.mat')); for k = 1:nume...

3 days ago | 1

| accepted

Answered

Plot function with varying variable

The MATLAB approach is to use logical indexing, e.g.: z = 0:0.1:5; y = 2; f = z*y; idx = z>1; % logical index f(idx) = 2*z(...

Plot function with varying variable

The MATLAB approach is to use logical indexing, e.g.: z = 0:0.1:5; y = 2; f = z*y; idx = z>1; % logical index f(idx) = 2*z(...

3 days ago | 0

Answered

Sorting of points in 2D

Here is some simple code that that works quite nicely for your aerofoil. The code assumes that the top and bottom are both funct...

Sorting of points in 2D

Here is some simple code that that works quite nicely for your aerofoil. The code assumes that the top and bottom are both funct...

4 days ago | 1

| accepted

Answered

Why MATLAB asks for "more input arguments" in the function which is to be handled by ode45?

"However, exactly this is the syntax in the MATLAB documentation" I very much doubt that the MATLAB documentation shows any rec...

Why MATLAB asks for "more input arguments" in the function which is to be handled by ode45?

"However, exactly this is the syntax in the MATLAB documentation" I very much doubt that the MATLAB documentation shows any rec...

4 days ago | 0

| accepted

Answered

How to only replot part of a graph?

"Is there a way to only replot the changed point and the curve around it," Yes: you just need to change the XData and YData val...

How to only replot part of a graph?

"Is there a way to only replot the changed point and the curve around it," Yes: you just need to change the XData and YData val...

4 days ago | 0

Answered

floating point arithmetics, mathlab's interpretation of a . after a number

"Why doesn't e yield 0?" Because most of your values cannot be exactly represented using binary floating point numbers. The va...

floating point arithmetics, mathlab's interpretation of a . after a number

"Why doesn't e yield 0?" Because most of your values cannot be exactly represented using binary floating point numbers. The va...

5 days ago | 1

| accepted

Answered

How to create arrays from repeated matrix raws?

>> A = [1,2,3,4,5;1,2,8,9,10;1,2,13,14,15;11,12,16,27,18;11,12,19,29,21;11,12,22,23,24] A = 1 2 3 4 5 1 ...

How to create arrays from repeated matrix raws?

>> A = [1,2,3,4,5;1,2,8,9,10;1,2,13,14,15;11,12,16,27,18;11,12,19,29,21;11,12,22,23,24] A = 1 2 3 4 5 1 ...

6 days ago | 1

| accepted

Answered

Automatically Update Plots on GUI With Multiple Sliders

One simple approach is to have one "update" function in your GUI and call it from each individual callback: function slider1Cal...

Automatically Update Plots on GUI With Multiple Sliders

One simple approach is to have one "update" function in your GUI and call it from each individual callback: function slider1Cal...

6 days ago | 2

| accepted

Answered

Sort() function return wrong values

You are not assigning the sorted matrix to anything. You need to assign it to a variable, e.g.: minCell = minCell(s, :);

Sort() function return wrong values

You are not assigning the sorted matrix to anything. You need to assign it to a variable, e.g.: minCell = minCell(s, :);

6 days ago | 0

| accepted

Answered

Find index of element closest to other index

>> B1 = [0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1] B1 = 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 >> B2 = [1,1,...

Find index of element closest to other index

>> B1 = [0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1] B1 = 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 1 >> B2 = [1,1,...

7 days ago | 0

| accepted