Answered
how do i find the min value using for loop?
syms x smin = inf; % initialize smin for yr = linspace(0,1,10) f = sin(x); fL = [0 pi]; iL = [0 pi]; ...

5 days ago | 0

| accepted

Answered
Converting a 2d array into a 3d array
"it is taking lot of time" for what size of array? m=200; n=100; Z_int = rand(m, n); Z = nan(m,m,n); tic for i = 1 : size(...

5 days ago | 0

Answered
How Can I determine minimum value in a double array?
vect =[ 2.6660 2.2852 10.0000 3.2617 10.0000 10.0000 9.8532]; [vmin, idx] = min(vect)

5 days ago | 0

Answered
I want to colour the area between red line and black line below the intersection point. how am i going to do it?
c=[3,5]; A=[1,2;1,1;0,1]; b=[2000;1500;600]; y1=0:1:max(b); x21=(b(1)-A(1,1)*y1)./A(1,2); x22=(b(2)-A(2,1)*y1)./A(2,2); x2...

5 days ago | 1

Answered
How to vectorize the function?
fc=1e+8; % carrier fm=1e+3; % modulate fd=7.5e+4; % frequency deviation r=0.25; t0=0.0005; % reflection and delay w0=2*pi...

5 days ago | 1

Answered
How do I move an item in an array to the end of that array?
T = [1 5 77 10 15 20 25 33]; T1 = sort(T) % Method 1 T2 = T([1:2 4:end 3]) % Method2

5 days ago | 0

Answered
How to set x axis in a plot?
subplot(6,1,1:5); imagesc([1 8], [14, 22], randi(100,100)); subplot(8,1,8); imagesc([1 8], 1, [1 2 2 2 2 2 2 3 3]); set(gca, ...

5 days ago | 0

| accepted

Answered
How to create a moving average filter to a specific signal
x = readmatrix("2013.txt"); n = 7; % filter order y = filter(ones(n, 1)/n, 1, x); plot(x); hold on; plot(y); legend('Or...

5 days ago | 0

Answered
use matlab code to draw the joint PMF and CDF
[x, y] = meshgrid([0 1], [0 1]) z = [0.25 0.5; 0.125 0.125]'; stem3(x, y, z) xlabel('x'); ylabel('y'); zlabel('p')

5 days ago | 0

Answered
Extract Tables from within a cell
s = load("Tables") % i-th tables i = 1; t = s.Tables{i}

6 days ago | 0

| accepted

Answered
Populating a vector between upper and lower bound?
e0 = 0; % Initial strain values e_max = 4; % Max strain values inc = 1; % +ve increase, -ve decrease e_t ...

6 days ago | 0

| accepted

Answered
same number in the vector
h=[0.12;0.1;0.1;0.04;0.04;0.04;0.1;0.1;0.1;0.06;0.1] hu = unique(h); idx = sum(h -hu' == 0) > 1; hrep = hu(idx)

6 days ago | 0

| accepted

Answered
cluster points within given radius
n = 300; R = 350; x0 = 50; % Center of the circle in the x direction. y0 = 90; % Center of the circle in the y direction. an...

6 days ago | 0

Answered
Subplot with Geoaxes.
"geoaxes" cannot be the child of subplot. But we can set its position as follows (2x2 grid for example): for i=1:2 for j...

6 days ago | 0

Answered
Getting the a day of a month based on Vac(day,month)
calendar(2021, 3)

6 days ago | 0

Answered
convert real numbers to img form
a = 8 b = a*1i % method 1 c = complex(0, a) % method 2

7 days ago | 1

Answered
Restricting time on graph with given time
a = datetime(2021, 1, 1:365); b = rand(size(a)); plot(a, b) idx = find(month(a)==1); xlim([a(idx(1)), a(idx(end))])

7 days ago | 1

Answered
How to add a cylinder to a scattered plot
% A = load ('Data.txt'); A = 0.05*rand(8, 4) x = A (:,1 ) ; y = A (:,2 ) ; z = A (:,3 ) ; Amplitude = A (:,4) ; scatter3 ...

7 days ago | 0

| accepted

Answered
Calculating mean square difference (MSD) of two matrices
Im = [0 252 204; 221 135 58; 156 122 127] Im2 = [169 250 237; 186 196 148; 227 148 4] F2 = sum(sum(mean(Im...

8 days ago | 0

| accepted

Answered
how to save variable as txt in a specified location with variable value appearing in the file name
a=1; % amplitude du faisceau gaussien x=linspace(-50,50,100); dx=50/2.355; % widthn f=a*exp(-0.5*(x./dx).^2); [pks, locs, wi...

9 days ago | 0

| accepted

Answered
Quiver plot when axes scale are too different result in very ugly plots
load("quiverPlotVariables.mat") whos % You need to scale the vdot and/or psidot so that they are representing % the true orie...

10 days ago | 0

Answered
How can delete the variable part?
s = load("T9S11.mat"); x = s.T9S11 x(2:2:end,:)=[]

10 days ago | 1

| accepted

Answered
repmat usage for cellarray
data_string = reshape(char(32:127), 3, []) % some characters32 x 3 char aray cell_array=repmat({data_string},1,3) cell_array{...

15 days ago | 0

Answered
Append vector into zero matrix
v = zeros(5, 3); x = randn(3,1); n = numel(x); for i=1:size(v, 2) v(i-1+(1:n), i) = x; end v

16 days ago | 0

| accepted

Answered
benefits of using "Structs" over "Cells" in MATLAB/Octave?
See the documentation: https://www.mathworks.com/help/matlab/matlab_prog/cell-vs-struct-arrays.html Struct use field name to ac...

16 days ago | 0

Answered
Marker edges, line width and legend
xx=linspace(0,12); figure(1) plot(xx,sin(xx),'LineStyle','-','LineWidth',2,... 'Color','red', 'HandleVisibility','off');...

16 days ago | 0

Answered
Modify a text file
% Assume that your text file is data.txt s = fileread("data.txt"); s = strrep(s, '4.500000e-001', '0.8000'); fid = fopen('d...

16 days ago | 0

Answered
nanstd use in matlab
You are using default normalization "[]", which normalised the std by (N-1). If you want to get 0.0129, you need to change [] i...

16 days ago | 1

| accepted

Answered
What's wrong in the code? I cant generate the same graph as the question required.
x = -5:0.1:5; y = sin(x.^2).*exp(cos(x)); plot(x,y)

16 days ago | 0

| accepted

Answered
I have problem with while loop.
Make the following change: %while (szb(1,1)~=szA(1,1) && szb(1,2)~=1) while (szb(1,1)~=szA(1,1) || szb(1,2)~=1)

16 days ago | 1

| accepted

Load more