Answered
Unexpected pdist2 behavior?
In the DOC of PDIST2 it has been mentioned that the custom distance must able to accept second parameter of (m x 3) as m points ...

7 years ago | 0

Answered
Frequency Response Function and Delay
When you compute the phase there is always an arbitrary shift of (k*2*pi), k integer. I think a reasonable assumption is make...

7 years ago | 0

Answered
How to use if statement to compare strings
if isempty(genderInput) || (lower(genderInput(1)) ~= 'm' || lower(genderInput(1)) ~= 'f') genderInput = input('Please ...

7 years ago | 0

Answered
Unique values per row
>> A=[1 2 3; 4 4 5; 6 6 6] A = 1 2 3 4 4 5 6 6 6 >> sum(diff...

7 years ago | 5

| accepted

Answered
Finding the index of a string within an array of strings
May be this is what you want? find(strcmp({'0' 'P' 'E' 'M'},'P'))

7 years ago | 3

| accepted

Answered
Temperature variation against time
Your expectation is wrong (((QQ2(j)*A*3600))-(mw*lw)) are negative (from -1.4458e+07 to -1.1234e+7) Therefore as lon...

7 years ago | 1

Answered
How to find the indices of a matrix element that is inf or NaN?
Wrong diagnostic: h = find(~isfinite(V)) is right. You probably shadow something or V is not what you think of.

7 years ago | 3

Answered
when I run this code I get Undefined function or variable 'U'.
MATLAB makes distinction between upper case and lower case in variable name. If you call [u,d,v]=svd(K); then you have t...

7 years ago | 1

Answered
I have one curve. I want to create another curve offset to that one at right angle.
<</matlabcentral/answers/uploaded_files/139542/offset.png>> %initial conditions% t = 0:0.01:1; b0 = (1-t).^2; b1 =...

7 years ago | 0

| accepted

Answered
Can someone please help me implementing this code without loop ?
f = rand(4,5); [m,n] = size(f); x = 2:m-1; y = 2:n-1; v1 = max(abs(f(x+1,y)-f(x,y)),abs(f(x-1,y)-f(x,y))); v2...

7 years ago | 0

| accepted

Answered
Why Matrix dimensions do not agree?
Try this: load data1 P v; Vmax3 = 4; S2 = 40-P; Km3 = 3; k1 = 30; P0 = [Vmax3, Km3, k1]; ...

7 years ago | 1

| accepted

Answered
Diagonal matrix from multiple columns of an array
Take a look at |spdiags|

7 years ago | 0

| accepted

Answered
how to delete rows in cell array
>> A=rand(5,3) A = 0.3012 0.2259 0.9234 0.4709 0.1707 0.4302 0.2305 0.2277 0...

7 years ago | 0

| accepted

Answered
Vector of floating-point numbers
Yfit = predict(B,X)

7 years ago | 1

Answered
How do i generate a random set of numbers of -1s and 1s without getting any 0s?
values = [-1 1]; x = values(randi([1 2],[1000,1]))

7 years ago | 1

Answered
How do i generate a random set of numbers of -1s and 1s without getting any 0s?
x = 2*(rand(1000,1)>0.5) - 1

7 years ago | 0

Answered
How to update an element of vector every cycle?
MATLAB is 1-based indexing, you light change the for-loop to start at 1 for i= 1:iter_max or shift the storage index by ...

7 years ago | 0

| accepted

Answered
How to select only a few design points from a huge data space?
_'Problem is I can only identify the possibilities I am interested in by checking the value of each design point.'_ I'll save...

7 years ago | 0

Answered
solve 4 equations with some unknowns parameters.
Your problem looks like you find the EM field with 3 layers and 2 interfaces. The coefficients A, B, C, D gives the strength of ...

7 years ago | 0

| accepted

Answered
How to use fminimax
I believe for FMINIMAX the inner-max (min for your case) is performed on discrete set of variables, which corresponds the length...

7 years ago | 0

Answered
prime number.there isn't any error. my ans isn't showed up
There is actually one error (where counter is reset) for j= 1:10 counter=0; % <- reset for every i to be checked ...

7 years ago | 0

| accepted

Answered
How to find indices of a rectangular region inside big matrix? | Efficiently
recidx = (Row_start:Row_End)' + height*(Col_start-1:Col_end-1)

7 years ago | 1

| accepted

Answered
Why fix(0.05/0.05) isn't working properly in coint counting algorithm ? If I enter let's say 3.76 it gives me the correct answer,but when I enter 3.75,it gives me 9 coins..
Welcome to the word of numerical precision. |Rest| and |FiveCent| look the same but they are not equal: What is the amount...

7 years ago | 1

| accepted

Answered
multiplying all elements by fellow elements
Not clear what you want but KRON might be what you are looking for >> A=[1 2; 4 3] A = 1 2 4...

7 years ago | 1

Answered
How can I find a spline through points without exceeding known slope
Yet another <https://fr.mathworks.com/matlabcentral/fileexchange/25872-free-knot-spline-approximation FEX tool> that allows to c...

7 years ago | 1

| accepted

Answered
Performance comparison among Struct Array, Cell Array and Table
My general rule of thumbs: * Simple Array is the fastest * Using cell if you don't have a choice (mixing class or uniform si...

7 years ago | 3

Answered
Trying to write conditional if loop for an interval
This is not TeX or LaTeX disp(‘Cell Counts are within 10% limit’); MATLAB string quote is like this: disp('Cell Cou...

7 years ago | 0

Answered
Adding a constraint in @confun constrained optimization
Mathmematically you could define another constraint function h(x) := sup { g(y): y in [0,x] } then optimize your objecti...

7 years ago | 1

| accepted

Answered
Finding Shortest distance from a point to a Line,which passes through a midpoint and is oriented at an angle Theta to X-Axis
Assuming your points are (2 x 1) vectors d = abs(dot(Q-P,[-sin(theta);cos(theta)]))

7 years ago | 0

| accepted

Answered
Can .p files expire?
Probably the author implemented expiration check in the pfile, nothing exists in such for standard pfile.

7 years ago | 2

| accepted

Load more