Answered

exportgraphics r2020a issue

I didn't face this problem in R2020a update 2, however, I remember observing something like this (not exactly sure if it was exp...

exportgraphics r2020a issue

I didn't face this problem in R2020a update 2, however, I remember observing something like this (not exactly sure if it was exp...

5 hours ago | 0

Answered

Choose numerical type for table2array output

Seomthing like this T=table; T.var1=ones(10,1,'uint8'); T.var2=1000*ones(10,1,'double'); array = structfun(@double, table2st...

Choose numerical type for table2array output

Seomthing like this T=table; T.var1=ones(10,1,'uint8'); T.var2=1000*ones(10,1,'double'); array = structfun(@double, table2st...

14 hours ago | 0

Answered

regexp: \w* vs \w+

\w does not match spaces. \s is used to match spaces. \w only matches a-z A-Z 0-9 and underscore. Following attempts to show the...

regexp: \w* vs \w+

\w does not match spaces. \s is used to match spaces. \w only matches a-z A-Z 0-9 and underscore. Following attempts to show the...

15 hours ago | 0

| accepted

Answered

Slow computation speed using piecewise functions

Functions such as triangularPulse and piecewise are from the symbolic toolbox, and they can be very slow as compare to floating-...

Slow computation speed using piecewise functions

Functions such as triangularPulse and piecewise are from the symbolic toolbox, and they can be very slow as compare to floating-...

18 hours ago | 0

| accepted

Answered

Maximum recursion limit error

ode45 should be called outside the ODE function. Your actual ode function is this function dv=Question3(t,v) % dv/dt=8-4 dv=4...

Maximum recursion limit error

ode45 should be called outside the ODE function. Your actual ode function is this function dv=Question3(t,v) % dv/dt=8-4 dv=4...

18 hours ago | 1

| accepted

Answered

Input system nonlinear (Identification)

You can use randn() u = randn(1, 1000);

Input system nonlinear (Identification)

You can use randn() u = randn(1, 1000);

18 hours ago | 0

Answered

Problem relating to mathematical expression

Try this x = [0.1, 0.2, 0.4, 0.5, 0.4, 0.6, 0.6, 0.6, 0.2, 0.3]; n = numel(x); k = 5; if round(n/k)==n/k split = mat2ce...

Problem relating to mathematical expression

Try this x = [0.1, 0.2, 0.4, 0.5, 0.4, 0.6, 0.6, 0.6, 0.2, 0.3]; n = numel(x); k = 5; if round(n/k)==n/k split = mat2ce...

18 hours ago | 0

Answered

How to modify decimal places when exporting data with fprintf

Try this code a = {'C1', 'A1', 'B1'}' b = {'C', 'A', 'B'}' c = {1.1, 2.1, 3.1}' d = {1.16666, 2.16666, 3.16666}' e = {'C', ...

How to modify decimal places when exporting data with fprintf

Try this code a = {'C1', 'A1', 'B1'}' b = {'C', 'A', 'B'}' c = {1.1, 2.1, 3.1}' d = {1.16666, 2.16666, 3.16666}' e = {'C', ...

19 hours ago | 2

| accepted

Answered

Nernst Equation plotting in MATLAB

Try this code, I changed the range of T1 and used element-wise operator in the equation for Eout1 %Constant Temperature and Cha...

Nernst Equation plotting in MATLAB

Try this code, I changed the range of T1 and used element-wise operator in the equation for Eout1 %Constant Temperature and Cha...

24 hours ago | 0

| accepted

Answered

How can find the solution of this matrix system?

Try fsolve(): https://www.mathworks.com/help/releases/R2020a/optim/ug/fsolve.html sol = fsolve(@(X) X*A*X.'-B, rand(size(A)))

How can find the solution of this matrix system?

Try fsolve(): https://www.mathworks.com/help/releases/R2020a/optim/ug/fsolve.html sol = fsolve(@(X) X*A*X.'-B, rand(size(A)))

1 day ago | 0

Answered

How to display a variable for x and y values from code in UI Table

Run this example x1 = 1; x2 = 2; x3 = 3; y1 = 4; y2 = 5; y3 = 6; x = [x1; x2; x3]; y = [y1; y2; y3]; t = table(x, y); ...

How to display a variable for x and y values from code in UI Table

Run this example x1 = 1; x2 = 2; x3 = 3; y1 = 4; y2 = 5; y3 = 6; x = [x1; x2; x3]; y = [y1; y2; y3]; t = table(x, y); ...

1 day ago | 0

Answered

Is there a way to make dirac delta function be 1 at the origin?

Replace dirac with kroneckerDelta syms x f(x) = heaviside(x); g(x) = diff(f); Result >> g(0) ans = Inf Now run g(x) = s...

Is there a way to make dirac delta function be 1 at the origin?

Replace dirac with kroneckerDelta syms x f(x) = heaviside(x); g(x) = diff(f); Result >> g(0) ans = Inf Now run g(x) = s...

1 day ago | 0

| accepted

Answered

Filtering by several criteria

Something like this New=Salaries.Age_49(Salaries.Area==1 & Salaries.Year==2019) % find is not necessary, logical indexing will ...

Filtering by several criteria

Something like this New=Salaries.Age_49(Salaries.Area==1 & Salaries.Year==2019) % find is not necessary, logical indexing will ...

1 day ago | 0

Answered

How do I correctly type in the following functions into matlab

This is correct syntax syms theta t f1 = 1 + sin(theta)^2*csc(theta); f2 = 1/(1+sin(theta)); f3 = sin(t); f4 = sec(theta).^...

How do I correctly type in the following functions into matlab

This is correct syntax syms theta t f1 = 1 + sin(theta)^2*csc(theta); f2 = 1/(1+sin(theta)); f3 = sin(t); f4 = sec(theta).^...

1 day ago | 0

Answered

create plot with slice

Try this [X, Y, Z] = meshgrid(0:0.5:20, 0:0.5:20, 1:7); V = exp(-0.2*sqrt((X-10).^2+(Y-10).^2+(2*(Z-4)).^2)); % based on gue...

create plot with slice

Try this [X, Y, Z] = meshgrid(0:0.5:20, 0:0.5:20, 1:7); V = exp(-0.2*sqrt((X-10).^2+(Y-10).^2+(2*(Z-4)).^2)); % based on gue...

1 day ago | 0

Answered

How to pass a changing value from workspaces to Simulink?

If the value is continually changing in the base workspace, you need to use MATLAB function block and evalin() to read the updat...

How to pass a changing value from workspaces to Simulink?

If the value is continually changing in the base workspace, you need to use MATLAB function block and evalin() to read the updat...

1 day ago | 1

| accepted

Answered

Trial to display Capital letters on excel

xlswrite is used to write numeric matrices. If you want to write text data, then use writetable() or writecell(). For example T...

Trial to display Capital letters on excel

xlswrite is used to write numeric matrices. If you want to write text data, then use writetable() or writecell(). For example T...

1 day ago | 0

Answered

How to insert a background image into a 3d plot?

Try something like this img = imread('peacock.jpg'); ax1 = axes(); imshow(img, 'Parent', ax1); ax2 = axes('Color', 'none...

How to insert a background image into a 3d plot?

Try something like this img = imread('peacock.jpg'); ax1 = axes(); imshow(img, 'Parent', ax1); ax2 = axes('Color', 'none...

1 day ago | 0

| accepted

Answered

How to create sum block like this (photo) on simulink?

See the add block: https://www.mathworks.com/help/releases/R2020a/simulink/slref/add.html. However, if you want to connect signa...

How to create sum block like this (photo) on simulink?

See the add block: https://www.mathworks.com/help/releases/R2020a/simulink/slref/add.html. However, if you want to connect signa...

1 day ago | 0

Answered

how can i solve this problem

In the expressions of kiv and kdv, there is kp in the denominator. So, you should start the list of Kp from a non-zero value, fo...

how can i solve this problem

In the expressions of kiv and kdv, there is kp in the denominator. So, you should start the list of Kp from a non-zero value, fo...

1 day ago | 0

| accepted

Answered

Variable in plot title

Run this example titles = {'title1', 'title2', 'title3'}; for i=1:3 figure(i) plot(rand(1,10)); title(titles{...

Variable in plot title

Run this example titles = {'title1', 'title2', 'title3'}; for i=1:3 figure(i) plot(rand(1,10)); title(titles{...

1 day ago | 1

| accepted

Answered

Sorting maximum value array by same date and time

Try this T = readtable('test1.xlsx'); grps = findgroups(T.Time, T.Date); max_vals = splitapply(@max, T.Value, grps); T.Max...

Sorting maximum value array by same date and time

Try this T = readtable('test1.xlsx'); grps = findgroups(T.Time, T.Date); max_vals = splitapply(@max, T.Value, grps); T.Max...

1 day ago | 1

Answered

create specific color map and save it

Try this val_z = (10:51).'; idx = 1*(val_z<=10) + ... 2*((10<val_z) & (val_z<=25)) + ... 3*((25<val_z) & (val_z<=50)...

create specific color map and save it

Try this val_z = (10:51).'; idx = 1*(val_z<=10) + ... 2*((10<val_z) & (val_z<=25)) + ... 3*((25<val_z) & (val_z<=50)...

1 day ago | 0

| accepted

Answered

MATLAB on ramp, section 5.2, further practice.

Read this: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html. For example x = [1 2 3 4 5 6 ...

MATLAB on ramp, section 5.2, further practice.

Read this: https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html. For example x = [1 2 3 4 5 6 ...

1 day ago | 0

Answered

contourf with more colours

You can specify the 4 input argument to contourf() to specify the number of levels you want. contourf(x,y,z,50); % 50 levels wi...

contourf with more colours

You can specify the 4 input argument to contourf() to specify the number of levels you want. contourf(x,y,z,50); % 50 levels wi...

1 day ago | 0

| accepted

Answered

solve integral using ode45 (by derivative)

Try this M = @(T) integral(@(lambda) planck(lambda,T), 4e-7, 7e-7); s = M(10000); % T=10000 function me=planck(lambda,T) h...

solve integral using ode45 (by derivative)

Try this M = @(T) integral(@(lambda) planck(lambda,T), 4e-7, 7e-7); s = M(10000); % T=10000 function me=planck(lambda,T) h...

1 day ago | 0

Answered

how to obtain the mean for single variable/location of a multiple 3d .mat file ?

Something like this files=dir('*.mat'); totalfile = numel(files); V = zeros(1,totalfile); for a = 1:tot...

how to obtain the mean for single variable/location of a multiple 3d .mat file ?

Something like this files=dir('*.mat'); totalfile = numel(files); V = zeros(1,totalfile); for a = 1:tot...

1 day ago | 0

| accepted

Answered

How to plot a, as varibale stored chart?

MATLAB graphics objects cannot be saved as variable by using their handles. Once the figure closes, the handle becomes invalid. ...

How to plot a, as varibale stored chart?

MATLAB graphics objects cannot be saved as variable by using their handles. Once the figure closes, the handle becomes invalid. ...

2 days ago | 0

Answered

How to replace (in a vector ) every value by the average of the previous n samples? (To smooth a signal)

Try movmean() movmean(SE_rest, [100 0])

How to replace (in a vector ) every value by the average of the previous n samples? (To smooth a signal)

Try movmean() movmean(SE_rest, [100 0])

2 days ago | 1

Answered

converting cell to struct with fields

Something like this S.DeliArg = [DeliArg{:}]; S.AlgTry = [AlgTry{:}];

converting cell to struct with fields

Something like this S.DeliArg = [DeliArg{:}]; S.AlgTry = [AlgTry{:}];

2 days ago | 0

| accepted