Answered
How do I exact all the indexes with a certain value?
Don't use a loop. Just do, marker = Inpt_RZ2_chn002.dat > 3; The logical vector marker already functions as an index vector, e...

3 years ago | 0

| accepted

Answered
I keep having an error pop up for line 5. I'm trying to output 'm' sample pairs based off of the PMF of randomized variables X and Y
Your Px vector has 9 values but your X vector has only 5. They are expected to be of the same length.

3 years ago | 0

| accepted

Answered
plot line with function but doesn't appear like i want
plot([0,3.758,10] , [5,0,-3],'-o','MarkerFaceColor','b'); hold on plot([0,0],[0,5],':b'); plot([10,10],[0,-3],':b');hold off ...

3 years ago | 0

| accepted

Answered
Using a class as a function handle
Your definition of g does not make use of the input x. Was it supposed to be defined as below? g = @(x) analiseSismica(sb(x),s...

3 years ago | 0

| accepted

Answered
Make two vectors equal with zero inserted in the missed location values of the small vector
V1=[1,2,3,4,1,2,3,4]; V2=[1,2,4,1,3,4]; n1=length(V1); for i=1:n1 if i>length(V2) V2(end+1:n1)=0;...

3 years ago | 0

| accepted

Answered
Convex set: Finding the A and b matrices from Ax=b when the points of the convex set is known.
If you only need to address the 2D case, then you can use this: function [A,b]=vert2ineq2D(a) %Finds the expression of a 2D co...

3 years ago | 0

Answered
error while running graph=layerGraph(net)
Like I said, your 'net' is not one fo the types listed in the error message: net = googlenet('Weights','none'); net = La...

3 years ago | 0

Answered
set first derivative equal to zero with some constant
should I put it a number rather than a alphabet symbol to get proper result? You should just use fzero The symbolic solutions f...

3 years ago | 0

Answered
Common legend and axes using tiled layout
One way you can do it is with nested tiled layouts: TL=tiledlayout(5,1); %Outer layout t=tiledlayout(TL,2,2); %Inner layou...

3 years ago | 1

Answered
fminunc undefined at initial points
It looks like there are some parentheses in the wrong place. I'm betting the cost was supposed to be, J = -( y'*log(tmp_sig...

3 years ago | 0

Answered
Exclude some nodes from a 3D point cloud (select only neighboring nodes)
X=load('selection').selection; %shorten data name G=graph(pdist2(X,X)<=10); T=conncomp(G); [~,i]=max(histcounts(T,[uniq...

3 years ago | 0

| accepted

Answered
Adding fields of two different structs together
It would be a better to use a dictionary than a struct, part=dictionary(["x","y","z"],1:3); part("x")+part("z")

3 years ago | 0

| accepted

Answered
How to capture the view in volshow as an image?
I'm still interested as to whether or not there's a way to create an image in a figure of the current view so that you could uti...

3 years ago | 1

Answered
How do I do this summation equation in MATLAB
Looks like you could simply do it in one line with, eta=vecnorm(Y(:,1:N/2),2,2).^2/N ;

3 years ago | 0

| accepted

Answered
Shifting an array without circshift
circshift is not doing anymore than indexing into the array like below, so you could do that directly. x=1:10; xshift = x([e...

3 years ago | 0

Answered
How to save volshow(data,config) as fig or img [volumeViewer]?
See this related thread, https://www.mathworks.com/matlabcentral/answers/1960414-how-to-capture-the-view-in-volshow-as-an-image...

3 years ago | 1

Answered
Big struct variable to be shared by multiple functions/procedures. Global variable or not?
but I am wondering if this could be an exception I am not sure why you think it would be an exception. A big advantage of packi...

3 years ago | 0

Answered
There is a 1:1 mapping between the points in 2 separate 3D spaces. How do I pick a new point in one space and interpolate what the point will be in the other space?
If you have a parametric model for the 1-1 mapping, it might be a good idea to perform a fit to the model using e.g., lsqcurvefi...

3 years ago | 1

Answered
There is a 1:1 mapping between the points in 2 separate 3D spaces. How do I pick a new point in one space and interpolate what the point will be in the other space?
If your data is gridded, use griddedInterpolant. Otherwise, if it is scattered, use scatteredInterpolant. Since you are interpol...

3 years ago | 1

| accepted

Answered
Obtain Hessian matrix from a sum of squares expression
x=optimvar('x',[64,64]); Objective=0.0010309*x(11, 7)*x(13, 9) + 0.0016748*x(15, 11)*x(13, 9) + 0.0025*x(12, 7)*x(14, 9) + ...

3 years ago | 0

| accepted

Answered
How to find the maximum value of two variables of a function in MATLAB
Your function z is separable and monotonically decreasing in both variables. So, it should come as no surprise that the smallest...

3 years ago | 1

Question


Copy/paste over Remote Desktop
I often work on Matlab remotely using Windows' Remote Desktop. When doing so, I find that I can cut/copy items from Matlab's Cur...

3 years ago | 1 answer | 1

1

answer

Answered
Find locations of a value in 3-D matrix (lat x lon x time) and take the two time steps before and after those selected values
One way: sz=size(ls); [I,J,K]=ind2sub(sz, find(ls) ); A=precip(sub2ind(sz,I,J,K-2)); %2 hours before B=precip(sub2ind...

3 years ago | 0

Answered
Cell arrays with a vector within a cell within a cell
Maybe this is what you mean? C_in={[1;2;3],[4;5],6} n=max(cellfun('length',C_in)); C_out=num2cell(cell2mat( cellfun(@(x) ...

3 years ago | 0

| accepted

Answered
Cell arrays with a vector within a cell within a cell
Is this what you mean? C_in={{[1;2;3]},{[4;5]},{6}} C_out=[C_in{:}]

3 years ago | 0

Answered
my nonlinear constraints HAVE to be satisfied, what to do next?
(1) It is not possible to enforce equality constraints (e.g. Snell's Law) exactly , whether linear or non-linear. This is true b...

3 years ago | 0

| accepted

Answered
How to capture the view in volshow as an image?
There are programmatic ways to take a screenshot, e.g., https://www.mathworks.com/matlabcentral/fileexchange/24323-screencaptur...

3 years ago | 0

| accepted

Answered
trying to solve a system of 6 non linear equations to derive 6 unknown variables in terms of other known variables
It seems quite unlikely to me that the system has a symbolic solution.

3 years ago | 0

Answered
How to make a polyfit with constraints to the first and second derivative?
More often than not, if you have such constraints, it is spline that you want to fit, not a polynomial. Constrained spline fits ...

3 years ago | 1

| accepted

Answered
How to make a polyfit with constraints to the first and second derivative?
Well they are just linear constraints on the coefficients, so you could use lsqlin if you have the Optimization Toolbox.

3 years ago | 0

Load more