Answered

Set of sequnce number

If the number is not very large, then use A = [1,2,3,4,5,6,7,8]; n = numel(A); num = 10.^(n-1:-1:0)*A.'; hex = dec2hex(num);...

Set of sequnce number

If the number is not very large, then use A = [1,2,3,4,5,6,7,8]; n = numel(A); num = 10.^(n-1:-1:0)*A.'; hex = dec2hex(num);...

2 days ago | 0

Answered

2D colormaps. MxN matrix of RGB values for 4 colors gradient

Try this c{1} = [1 0 0]; % specify 4 colors c{2} = [0 1 0]; c{3} = [0 0 1]; c{4} = [1 0.5 0.2]; C = reshape(vertcat(c{:})...

2D colormaps. MxN matrix of RGB values for 4 colors gradient

Try this c{1} = [1 0 0]; % specify 4 colors c{2} = [0 1 0]; c{3} = [0 0 1]; c{4} = [1 0.5 0.2]; C = reshape(vertcat(c{:})...

2 days ago | 0

| accepted

Answered

Queries on the use of "double"

This is probably caused by symbolic preferences on your machines. I guess you have defined x as a symbolic variable before this ...

Queries on the use of "double"

This is probably caused by symbolic preferences on your machines. I guess you have defined x as a symbolic variable before this ...

2 days ago | 0

Answered

Finding minima in data as well as values near it

This will find all the local minima and the points around it. x = [17 12 3 15 46]; idx = islocalmin(x); idx = idx | circshi...

Finding minima in data as well as values near it

This will find all the local minima and the points around it. x = [17 12 3 15 46]; idx = islocalmin(x); idx = idx | circshi...

3 days ago | 0

Answered

how to convert this statement into matlab

Assuming all the functions and variables are defined BOOL_TO_REAL(~(PRM_EMS.PRG(p).ignorePwrAux))*EMS.PRG(p).PrcPwrAuxTotal; a...

how to convert this statement into matlab

Assuming all the functions and variables are defined BOOL_TO_REAL(~(PRM_EMS.PRG(p).ignorePwrAux))*EMS.PRG(p).PrcPwrAuxTotal; a...

3 days ago | 0

| accepted

Answered

Is it safe to make academic assignments on MATLAB Online by keeping in mind the plagiarism factor?

Yes, your MATLAB online drive is only accessible to you. No outsider has access to it without your account credentials. Unless y...

Is it safe to make academic assignments on MATLAB Online by keeping in mind the plagiarism factor?

Yes, your MATLAB online drive is only accessible to you. No outsider has access to it without your account credentials. Unless y...

3 days ago | 0

| accepted

Answered

Error while generating code using griddedinterpolate in matlab function

griddedInterpolant is still not supported for code generation: https://www.mathworks.com/help/referencelist.html?type=function&c...

Error while generating code using griddedinterpolate in matlab function

griddedInterpolant is still not supported for code generation: https://www.mathworks.com/help/referencelist.html?type=function&c...

3 days ago | 0

| accepted

Answered

Hex to float like python struct.unpack()

This is the correct way hex = 'C956F53D'; x = hex2dec(reshape(hex, 2, []).'); dec = typecast(uint8(x), 'single')

Hex to float like python struct.unpack()

This is the correct way hex = 'C956F53D'; x = hex2dec(reshape(hex, 2, []).'); dec = typecast(uint8(x), 'single')

3 days ago | 1

| accepted

Answered

Why is the SSIM value quite low for two same images

The issue is that you are using double() to convert the image to double format. The correct function to use here is im2double()....

Why is the SSIM value quite low for two same images

The issue is that you are using double() to convert the image to double format. The correct function to use here is im2double()....

3 days ago | 0

| accepted

Answered

How to construct (0,1)-matrices with prescribed row and column sum vectors

Since you are minimizing the dot product, the thing to realize is that this is an integer linear programming problem. Following ...

How to construct (0,1)-matrices with prescribed row and column sum vectors

Since you are minimizing the dot product, the thing to realize is that this is an integer linear programming problem. Following ...

3 days ago | 0

| accepted

Answered

Calculations on every 2nd row in a matrix in sets of 2 rows

Something like this f = fopen('data.txt'); data = textscan(f, '%f %f', 'HeaderLines', 1); fclose(f); data = [data{:}]; da...

Calculations on every 2nd row in a matrix in sets of 2 rows

Something like this f = fopen('data.txt'); data = textscan(f, '%f %f', 'HeaderLines', 1); fclose(f); data = [data{:}]; da...

3 days ago | 0

| accepted

Answered

How to create a square wave pulse

If you have signal processing toolbox T = 0.01; % 10 milliseconds timeperiod, 1 square wave in 10 milliseconds t = linspace(0,...

How to create a square wave pulse

If you have signal processing toolbox T = 0.01; % 10 milliseconds timeperiod, 1 square wave in 10 milliseconds t = linspace(0,...

3 days ago | 0

Answered

create a function while protecting it's code

I think you can try to create a mex function using MATLAB coder. It compiles your MATLAB code using C or C++ compiler and conver...

create a function while protecting it's code

I think you can try to create a mex function using MATLAB coder. It compiles your MATLAB code using C or C++ compiler and conver...

3 days ago | 0

| accepted

Answered

How to do 'less than but not equal to' nonlinear constraints in fmincon?

Numerical optimization algorithms already satisfy constraints with a tolerance value, so the less than (<) or less than equal to...

How to do 'less than but not equal to' nonlinear constraints in fmincon?

Numerical optimization algorithms already satisfy constraints with a tolerance value, so the less than (<) or less than equal to...

3 days ago | 1

Answered

Alternative to Save and Load

Try this method: https://www.mathworks.com/help/matlab/import_export/share-memory-between-applications.html. Otherwise, try usin...

Alternative to Save and Load

Try this method: https://www.mathworks.com/help/matlab/import_export/share-memory-between-applications.html. Otherwise, try usin...

3 days ago | 0

Answered

Filling between several curves in a figure using fill or patch functions

See this example y = 1:400; x1 = 0.1*rand(size(y)); x2 = 0.1*rand(size(y))+1; x3 = 0.1*rand(size(y))+0.4; x4 = 0.1*rand(s...

Filling between several curves in a figure using fill or patch functions

See this example y = 1:400; x1 = 0.1*rand(size(y)); x2 = 0.1*rand(size(y))+1; x3 = 0.1*rand(size(y))+0.4; x4 = 0.1*rand(s...

3 days ago | 1

| accepted

Answered

How to rotate a solid with revolute joint

See the attached file for an example.

How to rotate a solid with revolute joint

See the attached file for an example.

3 days ago | 0

Answered

Im trying to create two new file function base that will get call in my sqroot function. Im getting all types of errors when i try implementing

Do it like this. Create a file name fun1.m and write following in it function y = fun1(xn, num) f = xn^2-num; end Then ...

Im trying to create two new file function base that will get call in my sqroot function. Im getting all types of errors when i try implementing

Do it like this. Create a file name fun1.m and write following in it function y = fun1(xn, num) f = xn^2-num; end Then ...

3 days ago | 0

Answered

How to zoom in the figure/image/montage without the margin surround it?

Try something like this img1 = imread('pears.png'); imgs = {img1, rgb2gray(img1), imbinarize(img1)}; im = montage(imgs, 'Size...

How to zoom in the figure/image/montage without the margin surround it?

Try something like this img1 = imread('pears.png'); imgs = {img1, rgb2gray(img1), imbinarize(img1)}; im = montage(imgs, 'Size...

3 days ago | 0

Answered

I have 2D plot,how shall I make it look like a 3D like a view from top.

Are you trying to get something like this f = figure(); ax = axes(); hold(ax); view(ax, 3); grid(ax, 'on'); x = linspace...

I have 2D plot,how shall I make it look like a 3D like a view from top.

Are you trying to get something like this f = figure(); ax = axes(); hold(ax); view(ax, 3); grid(ax, 'on'); x = linspace...

3 days ago | 1

| accepted

Answered

How do I graph an ordinary differential equation with an initial condition?

dsolve() shows that the ODE might not have a symbolic solution. So you will need to resort to a numerical solution. Following sh...

How do I graph an ordinary differential equation with an initial condition?

dsolve() shows that the ODE might not have a symbolic solution. So you will need to resort to a numerical solution. Following sh...

4 days ago | 0

| accepted

Answered

Create script function VDC

Is v constant? In that case, you don't need to call integral(). You can just use VDC=v*(int_sup-int_inf). However, you can fix t...

Create script function VDC

Is v constant? In that case, you don't need to call integral(). You can just use VDC=v*(int_sup-int_inf). However, you can fix t...

4 days ago | 0

Answered

Laplace Transform of f(t)=Cos[5t-45^°]

Making a code complex just for the sake of it is a pointless question, especially for this forum. However, the following code sh...

Laplace Transform of f(t)=Cos[5t-45^°]

Making a code complex just for the sake of it is a pointless question, especially for this forum. However, the following code sh...

4 days ago | 1

| accepted

Answered

Finding specific number of characters in vector

Try setdiff() c = ['a' 'r' 'y' 'z' 'b' 'u' 'k']; n = numel(setdiff(c, ['b' 'r']));

Finding specific number of characters in vector

Try setdiff() c = ['a' 'r' 'y' 'z' 'b' 'u' 'k']; n = numel(setdiff(c, ['b' 'r']));

4 days ago | 0

Answered

Run length encoding error

I didn't understand the logic of your code, but here is an alternate solution. clear all clc data = importdata('Temperature.m...

Run length encoding error

I didn't understand the logic of your code, but here is an alternate solution. clear all clc data = importdata('Temperature.m...

4 days ago | 1

| accepted

Answered

How i can make heart rate estimation with live webcam ?

This FEX submission seems to be a good starting point: https://www.mathworks.com/matlabcentral/fileexchange/69293-heart-rate-mea...

How i can make heart rate estimation with live webcam ?

This FEX submission seems to be a good starting point: https://www.mathworks.com/matlabcentral/fileexchange/69293-heart-rate-mea...

4 days ago | 0

Answered

Count all green pixels above a threshold and colour them

See this example, this take the green channel of input image, find all pixels above a threshold, and give them red color. img =...

Count all green pixels above a threshold and colour them

See this example, this take the green channel of input image, find all pixels above a threshold, and give them red color. img =...

4 days ago | 1

Answered

why purchase optimization vs global optimization toolbox

Yes, you are correct. Therefore, the installation of the Optimization toolbox is a prerequisite for installing the Global Optimi...

why purchase optimization vs global optimization toolbox

Yes, you are correct. Therefore, the installation of the Optimization toolbox is a prerequisite for installing the Global Optimi...

4 days ago | 0

| accepted

Answered

Matlab Live script editor font does not respect settings

I think you are typing the code in the "text mode". In "code mode", the appear monospaced.

Matlab Live script editor font does not respect settings

I think you are typing the code in the "text mode". In "code mode", the appear monospaced.

4 days ago | 0

Answered

Transient Response of an RC circuit

I am not sure, but it seems to be related to the blocks from Specialized Power Library. The blocks from this library are not int...

Transient Response of an RC circuit

I am not sure, but it seems to be related to the blocks from Specialized Power Library. The blocks from this library are not int...

4 days ago | 0

| accepted