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

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

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

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

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

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

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

how to create shape on xy surface?

3 maanden ago | 0

| accepted

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

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

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

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

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

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

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

How to rotate a map?
It is upside down. Add the following: axis xy

4 maanden ago | 0

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

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

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

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

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

Scatter not showing full precision of data.

4 maanden ago | 0

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

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

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

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

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

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

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