Answered

Syntax Error Simulink fcn block

Try this function x_2dot = fcn(u) x_2dot = 0; % initialize to tell simulink about its size J = 0.01; B = 0.1; K = 0.01; R ...

Syntax Error Simulink fcn block

Try this function x_2dot = fcn(u) x_2dot = 0; % initialize to tell simulink about its size J = 0.01; B = 0.1; K = 0.01; R ...

1 hour ago | 0

Answered

using fprintf to display multiple values

Change the line to fprintf(' The factorial of %.0f is %.0f\n\n',numlist(i),facn) %...

using fprintf to display multiple values

Change the line to fprintf(' The factorial of %.0f is %.0f\n\n',numlist(i),facn) %...

1 hour ago | 0

Answered

How use interp2

You can use interp2 like this sigma = 1:6; OMEGA = 1:10; T = rand(6, 10); interp2(sigma, OMEGA, T.', 4, 5) % (4,5) is a sa...

How use interp2

You can use interp2 like this sigma = 1:6; OMEGA = 1:10; T = rand(6, 10); interp2(sigma, OMEGA, T.', 4, 5) % (4,5) is a sa...

12 hours ago | 0

Answered

trying to plot the graph but getting dots pls help me

Try this B=1; LL=1; n=1:0.25:2; s=0.5:0.5:10; for i = 1:numel(n) for j = 1:numel(s) y(i,j)=1+(n(i)*(0.5513*...

trying to plot the graph but getting dots pls help me

Try this B=1; LL=1; n=1:0.25:2; s=0.5:0.5:10; for i = 1:numel(n) for j = 1:numel(s) y(i,j)=1+(n(i)*(0.5513*...

12 hours ago | 0

| accepted

Answered

Writing variables in .csv file and saving it

If you have R2019a or later, you can save the data in a cell array and use writecell() C = {'abc', 1, 'def' 1; 'def', 2, 'rfg',...

Writing variables in .csv file and saving it

If you have R2019a or later, you can save the data in a cell array and use writecell() C = {'abc', 1, 'def' 1; 'def', 2, 'rfg',...

13 hours ago | 0

Answered

imshow produces error when used in subplot

From your code, it is not clear how did you assign the 2nd element of vector h. However, I recommend initializing 'h' with 'gobj...

imshow produces error when used in subplot

From your code, it is not clear how did you assign the 2nd element of vector h. However, I recommend initializing 'h' with 'gobj...

13 hours ago | 0

| accepted

Answered

Uninstalling old versions of MATLAB

Each version of MATLAB installs independent files. You can safely delete an older version. Note that if you have saved your own ...

Uninstalling old versions of MATLAB

Each version of MATLAB installs independent files. You can safely delete an older version. Note that if you have saved your own ...

14 hours ago | 0

Answered

Regarding a function saddle

In first code, 'j' varies from 1 to b for j=1:b In second code, 'j' varies from i to b for j = i:b

Regarding a function saddle

In first code, 'j' varies from 1 to b for j=1:b In second code, 'j' varies from i to b for j = i:b

14 hours ago | 0

| accepted

Answered

Create a continous stepwise increase in Simulink

You can use the MATLAB function block and a clock to create this signal as shown in the image The code inside the MATLAB func...

Create a continous stepwise increase in Simulink

You can use the MATLAB function block and a clock to create this signal as shown in the image The code inside the MATLAB func...

14 hours ago | 0

| accepted

Answered

DIfferentiating repetitions in a repeated sequence

Try this x = [1 1 1 1 2 2 2 3 3 3 3 3]; y = splitapply(@(x) {1000*x(1) + (1:numel(x))}, x, x); y = [y{:}]; Result >> y y...

DIfferentiating repetitions in a repeated sequence

Try this x = [1 1 1 1 2 2 2 3 3 3 3 3]; y = splitapply(@(x) {1000*x(1) + (1:numel(x))}, x, x); y = [y{:}]; Result >> y y...

15 hours ago | 1

Answered

How to vary the number of fields in inputdlg dynamically?

Something like this n = inputdlg('Number of Zones'); n = str2double(n{1}); prompts = compose('Zone %d', 1:n); y = inputdlg...

How to vary the number of fields in inputdlg dynamically?

Something like this n = inputdlg('Number of Zones'); n = str2double(n{1}); prompts = compose('Zone %d', 1:n); y = inputdlg...

15 hours ago | 0

| accepted

Answered

Estimating inputs from outputs in neural networks

You may try fsolve(). However, due to the complexity of a neural network, it is unlikely that it will be able to find a solution...

Estimating inputs from outputs in neural networks

You may try fsolve(). However, due to the complexity of a neural network, it is unlikely that it will be able to find a solution...

16 hours ago | 0

Answered

How can I find the Power spectral density of a filtered Noise?

This example show how to plot PSD using FFT: https://www.mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft...

How can I find the Power spectral density of a filtered Noise?

This example show how to plot PSD using FFT: https://www.mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft...

16 hours ago | 0

Answered

explict (pointwise) function from numerical solution to implicit equation

Try interp1 to create an explicit relation for 'y' in term of 'x' using the datapoints from fimplicit f = @(x, y) y - x.^2; fp...

explict (pointwise) function from numerical solution to implicit equation

Try interp1 to create an explicit relation for 'y' in term of 'x' using the datapoints from fimplicit f = @(x, y) y - x.^2; fp...

16 hours ago | 0

Answered

Hey can you please help me with these errors im getting from my GUI

Try this set(handles.raiz,'String',num2str(r)); Convert the numeric value to character value.

Hey can you please help me with these errors im getting from my GUI

Try this set(handles.raiz,'String',num2str(r)); Convert the numeric value to character value.

16 hours ago | 0

Answered

Random numbers around y-values

Try this x = 1:100; y = log(x); noise = (2*rand(size(y))-1).*0.15.*y; y_noise = y + noise; plot(x, y, 'r', x, y_noise, 'b...

Random numbers around y-values

Try this x = 1:100; y = log(x); noise = (2*rand(size(y))-1).*0.15.*y; y_noise = y + noise; plot(x, y, 'r', x, y_noise, 'b...

16 hours ago | 0

Answered

Passing data to Simulink Model

See From workspace block: https://www.mathworks.com/help/releases/R2020a/simulink/slref/fromworkspace.html

Passing data to Simulink Model

See From workspace block: https://www.mathworks.com/help/releases/R2020a/simulink/slref/fromworkspace.html

16 hours ago | 0

Answered

Phase portrait of a 2 dimensional system that converges to a unit circle

try this dx_dt = @(x,y) (1-(x.^2+y.^2)).*x-3.*y.*(x.^2+y.^2); dy_dt = @(x,y) (1-(x.^2+y.^2)).*y+3.*x.*(x.^2+y.^2); [x, y] =...

Phase portrait of a 2 dimensional system that converges to a unit circle

try this dx_dt = @(x,y) (1-(x.^2+y.^2)).*x-3.*y.*(x.^2+y.^2); dy_dt = @(x,y) (1-(x.^2+y.^2)).*y+3.*x.*(x.^2+y.^2); [x, y] =...

17 hours ago | 1

| accepted

Answered

How can we find the internal width of a alphabet?

Try this im = im2double(imread('alif.png')); im_gray = rgb2gray(im); im_bin = imbinarize(im_gray); [row, col] = find(~im_b...

How can we find the internal width of a alphabet?

Try this im = im2double(imread('alif.png')); im_gray = rgb2gray(im); im_bin = imbinarize(im_gray); [row, col] = find(~im_b...

17 hours ago | 0

| accepted

Answered

How to get a column from a text file based on some conditions

Try this data = fileread('test.txt'); data = textscan(data, 'Node %1s: %f'); labels = [data{1}{:}]-64; vals = data{2}; Ar...

How to get a column from a text file based on some conditions

Try this data = fileread('test.txt'); data = textscan(data, 'Node %1s: %f'); labels = [data{1}{:}]-64; vals = data{2}; Ar...

17 hours ago | 0

Answered

error using "=" in solving equation

That syntax is incorrect in MATLAB. You need to use fsolve() to solve an equation numerically n=2.2; m=1.86; p=0.153; %p is d...

error using "=" in solving equation

That syntax is incorrect in MATLAB. You need to use fsolve() to solve an equation numerically n=2.2; m=1.86; p=0.153; %p is d...

21 hours ago | 0

Answered

please tell how ?

Try this num=[303 4848 0]; den=[1 16 164]; ea=tf(num,den); subplot(1,2,1) step(ea) [t, y] = ode45(@odeFun, [0 1], [303; ...

please tell how ?

Try this num=[303 4848 0]; den=[1 16 164]; ea=tf(num,den); subplot(1,2,1) step(ea) [t, y] = ode45(@odeFun, [0 1], [303; ...

1 day ago | 0

| accepted

Answered

How to create a local function during the code run

Dynamically creating a function name is not a recommended coding practice. Following shows how to do such a thing more efficient...

How to create a local function during the code run

Dynamically creating a function name is not a recommended coding practice. Following shows how to do such a thing more efficient...

1 day ago | 1

Answered

How to dramatically speed-up the function plot

I am not sure what is the purpose of using second code is instead of the first when both create the same plots, however, if you ...

How to dramatically speed-up the function plot

I am not sure what is the purpose of using second code is instead of the first when both create the same plots, however, if you ...

1 day ago | 0

Answered

Multiple prompt/input with inputdlg according to a value

Something like this num_colors = 4; prompts = cell(1, num_colors*2); prompts(1:2:end) = compose('Enter min value for color %d...

Multiple prompt/input with inputdlg according to a value

Something like this num_colors = 4; prompts = cell(1, num_colors*2); prompts(1:2:end) = compose('Enter min value for color %d...

1 day ago | 1

| accepted

Answered

How do I plot a X-Y graph in matlab with data using "to workspace" block

Something like this plot(out.xout{8}.Data, out.yout{8}.Data)

How do I plot a X-Y graph in matlab with data using "to workspace" block

Something like this plot(out.xout{8}.Data, out.yout{8}.Data)

1 day ago | 0

| accepted

Answered

Export variable/signal

Use writematrix() in R2019a and later writematrix(M, 'filename.txt') % M is matrix name for older versions, you can use dlmwri...

Export variable/signal

Use writematrix() in R2019a and later writematrix(M, 'filename.txt') % M is matrix name for older versions, you can use dlmwri...

1 day ago | 0

| accepted

Answered

Working with data in table

You can use data property to change data of a uitable object app.UITable.Data{2,3} = '1,2'; It will set 2nd row of 3rd column ...

Working with data in table

You can use data property to change data of a uitable object app.UITable.Data{2,3} = '1,2'; It will set 2nd row of 3rd column ...

1 day ago | 0

| accepted

Answered

Saving my .txt file as a .mat file to use it as data for my script.

Try these two options DataEnschede = readmatrix('etmgeg_290.txt', 'NumHeaderLines', 49); save('etmgeg_290.mat', 'DataEnschede'...

Saving my .txt file as a .mat file to use it as data for my script.

Try these two options DataEnschede = readmatrix('etmgeg_290.txt', 'NumHeaderLines', 49); save('etmgeg_290.mat', 'DataEnschede'...

1 day ago | 0

| accepted

Answered

Undefined function or variable 'inputParser' while using Matlab Function in Stateflow

It seems that the problem might be happening because the inputParser does not support code generation. You may try coder.extrins...

Undefined function or variable 'inputParser' while using Matlab Function in Stateflow

It seems that the problem might be happening because the inputParser does not support code generation. You may try coder.extrins...

1 day ago | 0

| accepted