Answered
How to avoid recursion in property set functions
The recursion can be avoided if all of the code leading up to the property assignment, along with the property assignment are al...

2 years ago | 0

| accepted

Answered
4D integral using integral and integral3
f = @(a, b, c, d) a+b+c+d; I = @(a, b, c) integral(@(d) f(a, b, c, d), 0, 1,'ArrayValued',1); f2=@(a, b, c) I(a,b,c)+1; I2=in...

2 years ago | 0

| accepted

Discussion


Implicit expansion for CAT()
Would it be a good thing to have implicit expansion enabled for cat(), horzcat(), vertcat()? There are often situations where I ...

2 years ago | 2

Answered
3D hexagonal mesh grid
V=nsidedpoly(6).Vertices; [X,Z]=ndgrid(V(:,1),0:3); [Y,~]=ndgrid(V(:,2),0:3); scatter3(X(:),Y(:),Z(:)); view(-60,70) xla...

2 years ago | 0

| accepted

Answered
A compact way to replace zeros with Inf in a matrix
Allso just for fun. A = [0 3 2 5 6; 1 1 4 3 2; 9 0 8 1 1; 5 9 8 2 0; 3 1 7 6 9]; A=A+1./(A~=0)-1

2 years ago | 3

Answered
How can I populate the rows of a difference matrix without using a for loop?
X=X(:); Y=Y(:); x=reshape(x,1,1,[]); y=reshape(y,1,1,[]); d=hypot( X - x , Y - y ); Diff=@(U,u) ((U(1)-u)./d(1,1,:)) ...

2 years ago | 0

| accepted

Answered
Converting 3D matrix to 2D matrix image
See rgb2gray or im2gray.

2 years ago | 0

| accepted

Answered
Can you help me design a Cylindrical Conical Helix
u=linspace(0,1,30); v=linspace(0,2*pi,30); [u,v]=meshgrid(u,v); x=(1-u).*(2.5+cos(v)).*cos(4.*pi.*u); y=(1-u).*(2.5+cos(v))....

2 years ago | 0

| accepted

Answered
How can I adjust the space between each subplot for a 5*3 subplots setup?
n=4; %1x4 figure; t=tiledlayout(1,n,'TileSpacing','tight'); for i=1:prod(t.GridSize) nexttile imagesc(phantom(12...

2 years ago | 0

Discussion


Do Reinvent the Wheel
Are there Matlab features which intend to satisfy your needs but fail in certain critical areas, forcing you to abandon them com...

2 years ago | 3

Answered
Can you help me design a Cylindrical Conical Helix
For example, t=linspace(0,20*pi,6000); R=exp(-0.1*t); x=R.*cos(t); y=R.*sin(t); z=R.*cotd(30); plot3(x,y,z)

2 years ago | 0

Answered
I cant find MLP-Mixer in MATLAB.
Maybe you can import it into Matlab from this pyTorch repository, https://github.com/lavish619/MLP-Mixer-PyTorch

2 years ago | 1

Answered
MATLAB refuses to display blue in converted JPEG image: is showing singular blue pixels
Make sure that you, (1) Use the same caxis in both image displays, (2) Convert to double first, then divide by 255. Not the...

2 years ago | 0

Answered
How can I adjust the space between each subplot for a 5*3 subplots setup?
The subaxis function in this FEX download https://www.mathworks.com/matlabcentral/fileexchange/3696-subaxis-subplot?s_tid=srcht...

2 years ago | 0

Answered
Creating a Grid for cooridnates
and I also do pick up a few spurious spots that are'nt part of the grid If outliers are present, I would use the approach belo...

2 years ago | 0

| accepted

Answered
How can I unflatten a dimension in a neural network?
Are you using importNetworkFromPyTorch ? I feel like it should take care of all of that.

2 years ago | 0

| accepted

Answered
Reshaping 4d array into 2d matrix with a specific pattern
reshape( permute(tempC,[2,1,4,3]) ,[N*J, I*K] );

2 years ago | 1

| accepted

Answered
Wrong output graph when using ifft on rectangular pulse?
h = fftshift(ifft(ifftshift(H))); % Calculate the time axis based on the new value of S t = ((0:S-1)-ceil((S-1)/2))/S/(f(2...

2 years ago | 1

Answered
Offsetting Data Though Curve Fitting
If the stress-strain data is all linear elastic (or if you can extract a portion that is), then you could use polyfit: p=polyfi...

2 years ago | 0

Answered
Creating a Grid for cooridnates
Use histcounts2. x =[3.9988 5.4914 7.3364 130.3843 132.5535 134.5383 257.6364 259.6390 261.5130 ...

2 years ago | 1

Answered
Adjoint / inverse nufft
If your t,f sampling is going to be reused, it may be gainful to use an algebraic inversion with the help of this FEX download, ...

2 years ago | 0

Answered
Adjoint / inverse nufft
If these are your actual data sizes, an optimization approach seems to work not too badly: t = [0:300 500.5:700.5]; S = 2*sin(...

2 years ago | 0

Answered
Trapezoidal Rule of Convolution with Non-Uniform Intervals
It is not clear from your post which two functions you are convolving, so I will assume here that it is the same as your other r...

2 years ago | 0

Answered
Using Values from Tabulated Data
t = [1 2.5 3.6 4]; A = [78 80 85 96]; Afun=@(tq)interp1(t,A,tq); Afun(1) Afun(2) Afun(2.5)

2 years ago | 1

| accepted

Answered
Find all intercepts for all parameter values
As an example, y=linspace(-1,1,1000); V=sin(pi*y-0.4); %fake input data loc=diff(sign(V)) & abs(y(1:end-1))<0.5; yinterc...

2 years ago | 0

| accepted

Answered
How to graph a convolution with same time length as inputs
Convolution doesn't make sense if your time points are not equi-spaced. You should interpolate everything so that they are: t=[...

2 years ago | 0

| accepted

Answered
calculating the provide integral
A common approach is to discretize the integral and instead compute sum of squared differences (SSD), e.g., SSD=norm( interp1(x...

2 years ago | 0

Answered
How to make a solid of revolution along the y-axis for a function with complex parts?
X = 0:0.1:pi; R = sqrt(9-0.5*(X-7).^2); R(imag(R)~=0)=nan; [z,x,y] = cylinder(R); surf(x,y,z); xlabel X;ylabel Y; zlabel Z; a...

2 years ago | 1

| accepted

Answered
Use logic index to sort back to original data that are logic 1.
opts=detectImportOption('test1gofcells.xlsx'); clear data for k=numel(ix):-1:1 opts.Sheet=k; if ix(k...

2 years ago | 0

| accepted

Answered
Problem fitting the curve with fminsearch
but when I set the function to be in polynomial or sinusoidal form it does not fit the curve to the experimental like it does w...

2 years ago | 0

Load more