Answered

Is there a way to adjust figure dimensions to automatically fit an axes to a patch object?

Are you looking for something like this ax = axes('Position', [0 0 1 1]); axis(ax, [0 1 0 1]); p = patch(ax, [0.2 0.4 0.4...

Is there a way to adjust figure dimensions to automatically fit an axes to a patch object?

Are you looking for something like this ax = axes('Position', [0 0 1 1]); axis(ax, [0 1 0 1]); p = patch(ax, [0.2 0.4 0.4...

environ un an ago | 0

| accepted

Answered

How to create a uipanel in GUI without guide?

If you want to create a panel, you need to use <https://www.mathworks.com/help/matlab/ref/uipanel.html |uipanel()|> function. Tr...

How to create a uipanel in GUI without guide?

If you want to create a panel, you need to use <https://www.mathworks.com/help/matlab/ref/uipanel.html |uipanel()|> function. Tr...

environ un an ago | 0

Answered

How to use one matlab program to create a new .m file and insert executable code into it which is from a separate file?

I don't understand why you need to create files dynamically like this. I believe there must be some other ways to do this task e...

How to use one matlab program to create a new .m file and insert executable code into it which is from a separate file?

I don't understand why you need to create files dynamically like this. I believe there must be some other ways to do this task e...

environ un an ago | 0

| accepted

Answered

Calculate high and low length of given square wave?

If you have _Image Processing Toolbox_, then one option is to use |regionprops()| to find the length of all the high areas and t...

Calculate high and low length of given square wave?

If you have _Image Processing Toolbox_, then one option is to use |regionprops()| to find the length of all the high areas and t...

environ un an ago | 1

| accepted

Answered

legend for transparent patch object is opaque ?

The problem is actually caused by the |Rendrer| of the figure object. In R2018a |opengl| seems to make the legend entries transp...

legend for transparent patch object is opaque ?

The problem is actually caused by the |Rendrer| of the figure object. In R2018a |opengl| seems to make the legend entries transp...

environ un an ago | 2

| accepted

Answered

How can I make below a certain value NaN so it does not effect my projection?

You can manually specify the |color| axis limit using <https://www.mathworks.com/help/matlab/ref/caxis.html |caxis()|>. For exam...

How can I make below a certain value NaN so it does not effect my projection?

You can manually specify the |color| axis limit using <https://www.mathworks.com/help/matlab/ref/caxis.html |caxis()|>. For exam...

environ un an ago | 0

Answered

Attempted to access data(1); index out of bounds because numel(data)=0. Error in RunAirfoilCase (line 62) alpha = data(1) ;

As error points out the variable |data| is empty. The problem appears to be happening in the line data = sscanf ( Line , '%...

Attempted to access data(1); index out of bounds because numel(data)=0. Error in RunAirfoilCase (line 62) alpha = data(1) ;

As error points out the variable |data| is empty. The problem appears to be happening in the line data = sscanf ( Line , '%...

environ un an ago | 0

Answered

How do i plot a graph between 3 variables?graph for x y and z

You need to index the variable Z, Z = zeros(size(X)); for i=2:37 Z(i)=(Y(i,1)-Y(i-1,1))/X(i,1); endl plot3(X...

How do i plot a graph between 3 variables?graph for x y and z

You need to index the variable Z, Z = zeros(size(X)); for i=2:37 Z(i)=(Y(i,1)-Y(i-1,1))/X(i,1); endl plot3(X...

environ un an ago | 0

| accepted

Answered

Step response of Estimated model in SID toolbox.

It tells that the step input in the identification process has a magnitude of 20. Therefore when you apply a step signal with th...

Step response of Estimated model in SID toolbox.

It tells that the step input in the identification process has a magnitude of 20. Therefore when you apply a step signal with th...

environ un an ago | 0

| accepted

Answered

How to plot only few points in X axis and y axis

Try this. x=linspace(0,1,N); xq = 0.333:0.333:1; dNew = interp1(x, d, xq); sNew = interp1(x, s, xq); figure ...

How to plot only few points in X axis and y axis

Try this. x=linspace(0,1,N); xq = 0.333:0.333:1; dNew = interp1(x, d, xq); sNew = interp1(x, s, xq); figure ...

environ un an ago | 0

Answered

Does the BlobAnalysis block is supported for stand-alone ROS node generation?

This <https://www.mathworks.com/help/releases/R2017b/ecoder/ug/supported-products-and-block-usage.html link> enlists all the blo...

Does the BlobAnalysis block is supported for stand-alone ROS node generation?

This <https://www.mathworks.com/help/releases/R2017b/ecoder/ug/supported-products-and-block-usage.html link> enlists all the blo...

environ un an ago | 0

| accepted

Answered

How to make a new matrix from find function results of different size

In a normal array, all rows and columns must have equal length. You need to use a cell array for j=1:B k=find(IC==j); ...

How to make a new matrix from find function results of different size

In a normal array, all rows and columns must have equal length. You need to use a cell array for j=1:B k=find(IC==j); ...

environ un an ago | 0

| accepted

Answered

I want to envelope the damped curve with an exponential function passing through the peak points. Can someone please help?

Since it is a second-order system, the envelop parameter |Io| can be analytically expressed as a function of |A1| and |A2|. The ...

I want to envelope the damped curve with an exponential function passing through the peak points. Can someone please help?

Since it is a second-order system, the envelop parameter |Io| can be analytically expressed as a function of |A1| and |A2|. The ...

environ un an ago | 0

| accepted

Answered

How can I do the best fit of a power function with my original data

You can use |lsqcurvefit()| for least square curve fitting. For example % sample data x = 0:10; y = x.^0.33 + 0.2*rand(...

How can I do the best fit of a power function with my original data

You can use |lsqcurvefit()| for least square curve fitting. For example % sample data x = 0:10; y = x.^0.33 + 0.2*rand(...

environ un an ago | 1

| accepted

Answered

for loop grabs last element of array

You are getting last value because you are writing this line after the loop is complete. At the end of the loop, the value of |k...

for loop grabs last element of array

You are getting last value because you are writing this line after the loop is complete. At the end of the loop, the value of |k...

environ un an ago | 0

Answered

converting a cell array of doubles in a matrix

A{1} = rand(1,9); A{2} = rand(1,9); cell2mat(A') A = 1×2 cell array {1×9 double} {1×9 double} ans = ...

converting a cell array of doubles in a matrix

A{1} = rand(1,9); A{2} = rand(1,9); cell2mat(A') A = 1×2 cell array {1×9 double} {1×9 double} ans = ...

environ un an ago | 1

| accepted

Answered

fprintf and arrays of varying length

A = [1 1 1 1 1]; repmat('%d ', 1, length(A)) ans = '%d %d %d %d %d ' sprintf(repmat('%d ', 1, length(A)), A) ans ...

fprintf and arrays of varying length

A = [1 1 1 1 1]; repmat('%d ', 1, length(A)) ans = '%d %d %d %d %d ' sprintf(repmat('%d ', 1, length(A)), A) ans ...

environ un an ago | 0

| accepted

Answered

In a constrained optimization if "beq" is a matrix with a variable, then how to plot the variable in "beq" and the objective function?

You are not saving all the values of |fval|. Try this fun = @(x)sum((x.*(log(x)))); A = []; b = []; x0 = [1/6 1/6 1/6 1/...

In a constrained optimization if "beq" is a matrix with a variable, then how to plot the variable in "beq" and the objective function?

You are not saving all the values of |fval|. Try this fun = @(x)sum((x.*(log(x)))); A = []; b = []; x0 = [1/6 1/6 1/6 1/...

environ un an ago | 1

| accepted

Answered

How do I resample data from 1 sample per second to 50 samples per second?

You can use interp1 to resample the data by interpolation. For example, try t1_resampled = interp1(linspace(0, 1, length(t1...

How do I resample data from 1 sample per second to 50 samples per second?

You can use interp1 to resample the data by interpolation. For example, try t1_resampled = interp1(linspace(0, 1, length(t1...

environ un an ago | 0

| accepted

Answered

Slider Controls X axis on Graph

You need to add |valueChaningFcn| callback. See the attached sample to see how to use the slider to control axes in App designer...

Slider Controls X axis on Graph

You need to add |valueChaningFcn| callback. See the attached sample to see how to use the slider to control axes in App designer...

environ un an ago | 0

Answered

Ho to convert .mat to an vektor?

Here is a solution s = load('filename.mat'); this will create a single struct with variable name as filed names. To obta...

Ho to convert .mat to an vektor?

Here is a solution s = load('filename.mat'); this will create a single struct with variable name as filed names. To obta...

plus d'un an ago | 0

Answered

How can I change struct name in a loop

Although there _is_ a MATLAB function to do this, but it is a <https://www.mathworks.com/matlabcentral/answers/304528-tutorial-w...

How can I change struct name in a loop

Although there _is_ a MATLAB function to do this, but it is a <https://www.mathworks.com/matlabcentral/answers/304528-tutorial-w...

plus d'un an ago | 1

| accepted

Answered

Simple function constrainting a polyfit with lsqlin is giving strange fits

You either need to use |polyfit| or |lsqlin|, you don't need to use both together. If all you care about is a polynomial fit to ...

Simple function constrainting a polyfit with lsqlin is giving strange fits

You either need to use |polyfit| or |lsqlin|, you don't need to use both together. If all you care about is a polynomial fit to ...

plus d'un an ago | 0

Answered

How do I save, chaning the name of the file and workspace that I save?

You should never directly load |mat| file to the workspace, always load the |mat| file to a variable <%3Chttps://www.mathworks.c...

How do I save, chaning the name of the file and workspace that I save?

You should never directly load |mat| file to the workspace, always load the |mat| file to a variable <%3Chttps://www.mathworks.c...

plus d'un an ago | 1

Answered

How to replace half the number of specific element in an array?

Here is one possible solution A=[1 2 3 4 4 1 2 4 4 3 4 4 4 2 1 3 4 4 4 2 1 4 4]; index = find(A==4); randomIndex = randpe...

How to replace half the number of specific element in an array?

Here is one possible solution A=[1 2 3 4 4 1 2 4 4 3 4 4 4 2 1 3 4 4 4 2 1 4 4]; index = find(A==4); randomIndex = randpe...

plus d'un an ago | 1

Answered

Numerically Solving a System of Differential Equations Using a First-Order Taylor Series Approximation

You will need to introduce extra variables to convert the 2nd order equations to first order. I have assumed the following varia...

Numerically Solving a System of Differential Equations Using a First-Order Taylor Series Approximation

You will need to introduce extra variables to convert the 2nd order equations to first order. I have assumed the following varia...

plus d'un an ago | 1

| accepted

Answered

Need help regarding colorbar?

If you want white color exactly at the center corresponding to value 0 then you will need to make the limit of |caxis()| symmetr...

Need help regarding colorbar?

If you want white color exactly at the center corresponding to value 0 then you will need to make the limit of |caxis()| symmetr...

plus d'un an ago | 0

| accepted

Answered

How can I plot multichannel data in 2d plot like attached image.

You can obtain something similar using |pcolor()|. For Example [x, y] = meshgrid(1:128, 0:70); % 2d meshgrid z = sort(rand...

How can I plot multichannel data in 2d plot like attached image.

You can obtain something similar using |pcolor()|. For Example [x, y] = meshgrid(1:128, 0:70); % 2d meshgrid z = sort(rand...

plus d'un an ago | 0

| accepted

Answered

How can I remove quotes from my struct?

If by remove quotes, you mean convert it to numeric format then try temp = num2cell(str2double({EEG_all.event.type})); [EE...

How can I remove quotes from my struct?

If by remove quotes, you mean convert it to numeric format then try temp = num2cell(str2double({EEG_all.event.type})); [EE...

plus d'un an ago | 1

| accepted

Answered

How to implement an array in simulink?

You didn't explain what does not work with |Sine wave| block. See the attached Simulink model to see how to use the Sinewave blo...

How to implement an array in simulink?

You didn't explain what does not work with |Sine wave| block. See the attached Simulink model to see how to use the Sinewave blo...

plus d'un an ago | 0