You could also create your own specialized function that does it - [M,N,P,K]=deal(2,3,4,5); A=rand(M,N,P); B=rand(M,N,K); ...

1 year ago | 1

You didn't complete your description of why reshape() is "a bit annoying". If you're going to be doing the same operation repea...

1 year ago | 0

Question

Behavior with unspecified output arguments
I am a bit puzzled by the behavior I see in the below example. I thought Matlab will always check that a function call assigns a...

1 year ago | 1 answer | 1

### 1

Replacing old version graphshortestpath with new shortestpath function
I tried replacing graphshortestpath() with shortestpath() and matlab still says the function is undefined. A strange thing to ...

1 year ago | 0

How can I implement this equation in matlab?
All of the summations can be pre-computed using matrix multiplication, e.g. - The results of the...

1 year ago | 0

| accepted

Hi! How to fix plane position as a 0 degree angle for Phi azimuth angle or how Matlab understand where Phi angle should be drawn?
A = 3.67 * sin(Phi0) * cos(Theta0); B = 3.67 * sin(Phi0) * sin(Theta0); C = 3.67 * cos(Phi0);

1 year ago | 0

| accepted

How would this be solved
Remember that the vector derivative of a parametric curve is tangent to the curve - syms r(theta) r(theta)=[2+3*cos(2*theta)...

1 year ago | 0

Unable to perform assignment because the size of the left side is 1 by 1 and the size of the right side is 1 by 2
You cannot do this - x=[1,2,3], x(1)=[5,6] %left side 1x1. right side 1x2

1 year ago | 0

| accepted

how to plot 100x100 data set
X=rand(100); Y=rand(100); scatter(X,Y);

1 year ago | 0

mask a matrix based on values in two arrays

1 year ago | 0

how can i change the value of a variable with a slider in matlab designer?
Here is a doc page talking about the general process of writing component callbacks in appdesigner. In this particular section, ...

1 year ago | 0

Minimise memory requirements when importing many images
Why is it better to use NaNs instead of zeros? A value of 0 doesn't conflict with anything because all of your nontrivial values...

2 years ago | 0

How to code binary Fibonacci sequence?
"where the successive elements of the sequence are obtained as the concatenation of the two previous ones" No, see - https://e...

2 years ago | 0

| accepted

Question

A*1 and A+0 could be faster.
Regardless of the size of a matrix A, operations A*1 and A+0 should be very fast. A simple pre-check would detect if one of thes...

2 years ago | 1 answer | 1

### 1

How to call a function with vector input in the fit type function?
SCR has to be a 1D function of the independent variable nu, meaning it has to give valid output when nu is a scalar. That is not...

2 years ago | 1

What is the recommended way to pass long list of parameters between main workspace and function?
Do not use load/save to introduce undeclared variables in your workspace. This can have unexpected effects as described in this ...

2 years ago | 0

Converting a system of coordinates
You cannot do a 3D coordinate conversion from a single 2D camera measurement. You need at least 2 cameras. If you have 2 cameras...

2 years ago | 0

How to find the index of the first absolute minimum entry of a matrix
A=[5,7,0.5,5 ; 2,1,4,1 ; 1,6,7,0.5], [value,index]=min(A(:)) [Iindex,Jindex]=ind2sub(size(A),index)

2 years ago | 0

| accepted

How to take double integral of a function matrix?
syms x y a=1; b=1; t=1; E=100/72; v=0.2; x1=0; x2=b; x3=b; x4=0; y1=0; y2=0; y3=a; y4=a; B1 = [y-y4;0;x-x2]; B2 = [0;x-x2;...

2 years ago | 0

define nonlcon in fmincon
function [c, ceq] = mycon(x) ceq=[]; c(1) = -nonlinearfunction1 % Compute nonlinear inequalities at x. c(2) c(3) ...

2 years ago | 0

| accepted

multi array vectorization problem (reformulated)
% init A = [ -0.8013 -0.4981; -0.2278 -0.9009]; t = 0:0.01:1e2; tic; % eigen space [V,D]=eig(A,'vector'); D = resh...

2 years ago | 1

Question

Since when has it been possible to dot-index the output of a class method?
Since when has it been possible to directly dot-index the output of a class method call, like this - classdef myClass p...

2 years ago | 1 answer | 1

### 1

How to formulate the following matrices?
Why not just - T=zeros(3,3,n); for i=1:n T(:,:,i) = [cos(theta(i)) -sin(theta(i)) x(i) sin(th...

2 years ago | 3

Finding close-to-linear solution
Using fsolve inside of fsolve is a doubtful-sounding thing to do. Why not just combine the equations from solveE with the equati...

2 years ago | 1

Input multiple arrays into function
Simpler example, L2 = [0 1/2 1/3 0 0 0 0; 1/3 0 0 0 1/2 0 0; 1/3 1/2 0 1 0 0 0; 1/3 0 1/3 0 1/2 0 0; ...

2 years ago | 0

| accepted

Problem with ploting exp function
If I had to guess, you have x and y reversed. [X, Y] = ndgrid(x, y); surf(X, Y, t(X,Y));

2 years ago | 1

Multiple fminbnd errors with a parametrized function
Here is a symbolic method, if that's what you wanted. syms t f(t) f(t) = exp(cos(t)) - sin((3^(1/2)*sin(t))/3); vpasolve(di...

2 years ago | 0

Condensing code cannnot figure out easier function to use
threshold=30; %don't call this "max" blocklen=300; difference=rand(1,9268); N=numel(difference); Nc=ceil(N/blocklen)*blo...

2 years ago | 0

Question