Answered

How to write a diagonal rectangular matrix

You can use toeplitz function. % Smaller n, m here n = 10; m = 8; A = diag(21*ones(n,1)) + diag(-4*ones(n-1,1),-1)... ...

How to write a diagonal rectangular matrix

You can use toeplitz function. % Smaller n, m here n = 10; m = 8; A = diag(21*ones(n,1)) + diag(-4*ones(n-1,1),-1)... ...

3 maanden ago | 0

| accepted

Answered

Bode plot of individual poles and zeros

z = 1000; p = [10 10 100]; k = 200; bode(zpk(z, p, k), 'k'); hold on for i=1:length(z) bode(zpk(z(i), [], 1/z(i)), ...

Bode plot of individual poles and zeros

z = 1000; p = [10 10 100]; k = 200; bode(zpk(z, p, k), 'k'); hold on for i=1:length(z) bode(zpk(z(i), [], 1/z(i)), ...

3 maanden ago | 0

Answered

How can I plot multiple signals in a single plot? Please give me suggestions which functions have used for this.

% Generate som data fs = 1000; t=(0:1/fs:1)'; f = 10:10:40; x = sin(2*pi*t*f); x = x + 0.1*randn(size(x)); n = size(x, 2)...

How can I plot multiple signals in a single plot? Please give me suggestions which functions have used for this.

% Generate som data fs = 1000; t=(0:1/fs:1)'; f = 10:10:40; x = sin(2*pi*t*f); x = x + 0.1*randn(size(x)); n = size(x, 2)...

3 maanden ago | 0

| accepted

Answered

How to retrieve data from a Excel sheet saved at a particular location in pc?

You need to provide the extension name (.xlsx ?) to the file.

How to retrieve data from a Excel sheet saved at a particular location in pc?

You need to provide the extension name (.xlsx ?) to the file.

3 maanden ago | 0

| accepted

Answered

How do you output both variable values and names in a function?

You can consider to use struct which has field names. t = Epoch_calc(20231121) function t = Epoch_calc(recorded_date) %EPOCH_...

How do you output both variable values and names in a function?

You can consider to use struct which has field names. t = Epoch_calc(20231121) function t = Epoch_calc(recorded_date) %EPOCH_...

3 maanden ago | 0

Answered

I have an Excel sheet with headers of different depths and the numbers are not being read (ex.: d=-12.82m is being read as x_12_82M),

% The first row is treated as var names. Use preserve to keep the original % format a = readtable("https://www.mathworks.com/...

I have an Excel sheet with headers of different depths and the numbers are not being read (ex.: d=-12.82m is being read as x_12_82M),

% The first row is treated as var names. Use preserve to keep the original % format a = readtable("https://www.mathworks.com/...

3 maanden ago | 1

| accepted

Answered

How do I form a matrix from an array of rows and columns

A=ones(10); a=[1 3 5 6 9]; b=[1 2 4 7 9]; A(sub2ind(size(A), a,b)) = 0; A

How do I form a matrix from an array of rows and columns

A=ones(10); a=[1 3 5 6 9]; b=[1 2 4 7 9]; A(sub2ind(size(A), a,b)) = 0; A

3 maanden ago | 1

| accepted

Answered

how to create shape on xy surface?

websave("variable.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1538662/variable.mat"); S = load('varia...

how to create shape on xy surface?

websave("variable.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1538662/variable.mat"); S = load('varia...

3 maanden ago | 0

| accepted

Answered

How to create a pulsing sound/use duty cycle

It seems that nSeconds should be 0.5s. Each pause should be also 0.5s. Thus it repeats 60 time in a min. Fs = 8000; %# S...

How to create a pulsing sound/use duty cycle

It seems that nSeconds should be 0.5s. Each pause should be also 0.5s. Thus it repeats 60 time in a min. Fs = 8000; %# S...

3 maanden ago | 0

| accepted

Answered

Need Help with FFT Analysis and Power Factor Calculation in MATLAB

Here is the work flow: 1.Read the CSV data in MATLAB with the "t" and "i(t)" column header as a table x = readtable("https:/...

Need Help with FFT Analysis and Power Factor Calculation in MATLAB

Here is the work flow: 1.Read the CSV data in MATLAB with the "t" and "i(t)" column header as a table x = readtable("https:/...

3 maanden ago | 0

Answered

Can I access the code for my packaged app?

Perhaps the most straightforward way is to convert your m-code to pcode (doc pcode for more details). Compiling is another optio...

Can I access the code for my packaged app?

Perhaps the most straightforward way is to convert your m-code to pcode (doc pcode for more details). Compiling is another optio...

3 maanden ago | 1

| accepted

Answered

I would like to create an array to store a password, website combo.

Use string array instead of cell array for efficiency. You can also considre to use table. pa = ["abc", "def"] pa = addPasswo...

I would like to create an array to store a password, website combo.

Use string array instead of cell array for efficiency. You can also considre to use table. pa = ["abc", "def"] pa = addPasswo...

3 maanden ago | 0

Answered

call function with multiparameter:what is the best solution?

You could also use arguments block. doc arguments for more details. a)CaricoSistemi2Last_Struct(Settings) b)CaricoSistemi2Las...

call function with multiparameter:what is the best solution?

You could also use arguments block. doc arguments for more details. a)CaricoSistemi2Last_Struct(Settings) b)CaricoSistemi2Las...

3 maanden ago | 0

| accepted

Answered

Error using plot: Not Enough Input Arguments

Your data is not in right format. Here is one way to convert the string to number. % Experiment 4 % Computations and Generate...

Error using plot: Not Enough Input Arguments

Your data is not in right format. Here is one way to convert the string to number. % Experiment 4 % Computations and Generate...

3 maanden ago | 1

| accepted

Answered

How do I write several variables to a table with row labels?

% Your data MeanAmplitude = rand(); AmpError = rand(); MeanFrequency = rand(); FrequencyError = rand(); % Name can be an...

How do I write several variables to a table with row labels?

% Your data MeanAmplitude = rand(); AmpError = rand(); MeanFrequency = rand(); FrequencyError = rand(); % Name can be an...

3 maanden ago | 1

| accepted

Answered

What is different between FFT and SHIFTFFT

First, it is not correct to say which is better unless you define what is "better". fft(x) has better resolution but higher si...

What is different between FFT and SHIFTFFT

First, it is not correct to say which is better unless you define what is "better". fft(x) has better resolution but higher si...

4 maanden ago | 0

| accepted

Answered

How to close only anova figures

How about collecting the desired figure handles in an array when creating the figures, such as h(i) = figure(...); At the en...

How to close only anova figures

How about collecting the desired figure handles in an array when creating the figures, such as h(i) = figure(...); At the en...

4 maanden ago | 0

Answered

I want to view a formula as a mathematical expression and not a single line

For displaying the formatted formula, you can use "livescrip". Simply save your file as ".mlx" file and run it. syms a b c sy...

I want to view a formula as a mathematical expression and not a single line

For displaying the formatted formula, you can use "livescrip". Simply save your file as ".mlx" file and run it. syms a b c sy...

4 maanden ago | 1

Answered

How to add a single line to my plot??

Your specification is not clear and this is a guess. x = 2*rand(10, 1); y = 2*rand(10, 1); scatter(x, y) hold on dx = 0.1; ...

How to add a single line to my plot??

Your specification is not clear and this is a guess. x = 2*rand(10, 1); y = 2*rand(10, 1); scatter(x, y) hold on dx = 0.1; ...

4 maanden ago | 1

| accepted

Answered

How to add legend in CIE diagram

plotChromaticity hold on x = rand(1,4); y=rand(1,4); name =["red", "blue", "green", "yellow"] for i=1:length(x) hs(i) ...

How to add legend in CIE diagram

plotChromaticity hold on x = rand(1,4); y=rand(1,4); name =["red", "blue", "green", "yellow"] for i=1:length(x) hs(i) ...

4 maanden ago | 1

| accepted

Answered

Scatter not showing full precision of data.

websave("data.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1514124/data.mat") load("data.mat") figure...

Scatter not showing full precision of data.

websave("data.mat", "https://www.mathworks.com/matlabcentral/answers/uploaded_files/1514124/data.mat") load("data.mat") figure...

4 maanden ago | 0

Answered

Loop over combinations of elements of several vectors

You can use combinations. % arbitrary number of vectors with arbitrary size v{1}=rand(3,1); v{2}=rand(2,1); v{3}=rand(2,1); ...

Loop over combinations of elements of several vectors

You can use combinations. % arbitrary number of vectors with arbitrary size v{1}=rand(3,1); v{2}=rand(2,1); v{3}=rand(2,1); ...

4 maanden ago | 0

Answered

Use sky colormap in old Matlab version

Copy the following data: c = sky(256); for i=1:height(c) fprintf("%9.6f %9.6f %9.6f\n", c(i, :)) end

Use sky colormap in old Matlab version

Copy the following data: c = sky(256); for i=1:height(c) fprintf("%9.6f %9.6f %9.6f\n", c(i, :)) end

4 maanden ago | 1

| accepted

Answered

code correction : subplot in for + length problem

figure for N = [10,40,100] subplot(2,1,1); hold on [axe,formula] = passe_bas(N); % brackets above st...

code correction : subplot in for + length problem

figure for N = [10,40,100] subplot(2,1,1); hold on [axe,formula] = passe_bas(N); % brackets above st...

4 maanden ago | 0

Answered

Export of table results in PDF

You can use livescript. Then you can hide the code and export to pdf. For example t=array2table(rand(3,2)); disp(t) Or you c...

Export of table results in PDF

You can use livescript. Then you can hide the code and export to pdf. For example t=array2table(rand(3,2)); disp(t) Or you c...

4 maanden ago | 0

Answered

Unwanted contour lines generated by contour()

Yo5ur function curve has very abrupt change near the ege (see one vertical slice of data). Therefore you will see many contour ...

Unwanted contour lines generated by contour()

Yo5ur function curve has very abrupt change near the ege (see one vertical slice of data). Therefore you will see many contour ...

4 maanden ago | 0

Answered

Greetings! I'm looking for assistance in understanding what's causing the problem in my code.

y = determineMode(4, 5, 6, 1, 2) function y = determineMode(teg, pv, pzt, ~, D, ~, ~, ~, ~) % Inputs: % teg: Voltage ...

Greetings! I'm looking for assistance in understanding what's causing the problem in my code.

y = determineMode(4, 5, 6, 1, 2) function y = determineMode(teg, pv, pzt, ~, D, ~, ~, ~, ~) % Inputs: % teg: Voltage ...

5 maanden ago | 0

Answered

Not enough inputs with input parser

F = @(x) x.^2.*sin(x)-0.2.*x.^3+3.*x.^2+x-4-0.005.*x.^4; nx = newtonsMethod(F,6.5) function x = newtonsMethod(func,guess,tol,d...

Not enough inputs with input parser

F = @(x) x.^2.*sin(x)-0.2.*x.^3+3.*x.^2+x-4-0.005.*x.^4; nx = newtonsMethod(F,6.5) function x = newtonsMethod(func,guess,tol,d...

5 maanden ago | 0

| accepted

Answered

How can I add recession bars to a time series plot?

data = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1488862/example_data.xlsx'); y = data.var3; x=...

How can I add recession bars to a time series plot?

data = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1488862/example_data.xlsx'); y = data.var3; x=...

5 maanden ago | 1

| accepted