Answered
How to vectorize a product of a tensor and a vector.
Hi Moslem Here is one way, and it does test out faster than the for loop. How much faster depends on the sizes of what I calle...

7 years ago | 0

| accepted

Answered
How to fit a line on the plane?
Hi M, Here is a way to fit a line in 2d with the equation a1*x1 + a2*x2 = 1 where (x1,x2) are (x,y). This representation get...

7 years ago | 0

| accepted

Answered
Extracting double from endless serial string
Hi Marcel, Here is another way. It produces one copy of the number whereas in your case str2double(Value) produces a 3x1 matri...

7 years ago | 1

| accepted

Answered
ODE45 2DOF Unable to perform assignment because the left and right sides have a different number of elements.
HI Piotr, I decided to post one last observation as an answer, which you may respond to as you wish. Since you have a couple o...

7 years ago | 0

| accepted

Answered
Identifying wave-number sign after applying 2-dimensional FFT
HI Bharati, WIthout going through the code in and detail (nice plot) I think the reason is the following. The cos wave is (1/...

7 years ago | 1

Answered
How to find velocity and position of this ODE
Hi Peter, since you have defined s(2) = ds(1)/dt, s(2) is the velocity function already. No more work required, exceptto plot...

7 years ago | 0

Answered
How do I call a function within another function?
[ MODIFIED to use the terminology 'nested functions'] Hi Sterling, You can define nested functions within other functions as i...

7 years ago | 1

| accepted

Answered
How do I get an array to display the list of float values?
Hi R^2, For array A, a quick answer is num2str(A) or disp(num2str(A)); which outputs a character array to look at. Sometime...

7 years ago | 0

Answered
How to take an integral of a matrix
Hi Radik, I assume you basically want to integrate each element in the resulting product matrix. Lots of inner and outer produ...

7 years ago | 0

| accepted

Answered
Plotting error for Bessel Function for "large" input values.
Hi Greg, Time to look at logs. The bessel function has a scaled version that keeps it from blowing up, and you can look at the...

7 years ago | 0

| accepted

Answered
solving an implicit ordinary differential equation
Hi Nariman, I assume that the two functions you show as f are not the same function, so I will denote the second one as g. And...

7 years ago | 0

Answered
About changing and adding path
Hi Raphael, See 'genpath' for how to create a string of a folder and all its subfolders (with some exceptions), then you can us...

7 years ago | 0

Answered
in desperate need for help (Trigonometric equation)
Hi solo, In situations like this it never hurts to plot out the function to see the zero crossings. I don't think people do th...

7 years ago | 1

Answered
convert vector a to b
Hi nurhayat, try [~, b] = sort(a) so that b is the set of indices of a such that a(1) = 1, a(2) = 2, a(5) = 3, a(3) = 4 etc. ...

7 years ago | 1

| accepted

Answered
How to write the colormap code for the colorbar presented in the figure?
Hi Naresh, Even if all you have is the jpg you can still make progess. I called the the jpg image A, and figure(1) image(A)...

7 years ago | 3

| accepted

Answered
Clarification regarding FFT required
Hello Dor, You are right about dividing by fs in this context, but in many other situations you divide by N, the number of fft ...

7 years ago | 1

Answered
Is there a more simple way to express this? How can I simplify everything under "case 2"? Is there an alternative to writing out everything under case 2?
Hi TSmith, you can get rid of one redundant line by replacing leapYear = (answer(1) == 'y'); if leapYear wit...

7 years ago | 1

| accepted

Answered
frequency error at fft of cos
Hi JC, I will not attempt to figure out what went wrong, but try n = length(t1); feq = (-n/2:n/2-1)*(Fs/n); also, dividing b...

7 years ago | 0

Answered
sampled signal fft signal
Hi yuval, You don't have to bother with omega since the fft operates with straight frequency. I arbitrarily picked the number ...

7 years ago | 0

| accepted

Answered
why 97 and 65?
Hi Mintra, this is quite likely related to the ascii character set char(97) ans = 'a' char(65) ans = 'A' small lette...

7 years ago | 1

Answered
Can any one please tell me that why the loop is running nXn times?
Hi Gaurav, You are only matching up to speaker 1 because in the 'test' function, variable x might equal zero but if not, it's h...

7 years ago | 1

| accepted

Answered
Inverse Laplace contains a complex number
Hi Karl You show one of the terms, and I assume you have another one that is the complex conjugate that one so that the entire ...

7 years ago | 2

| accepted

Answered
Hello everyone, how can I find a numerical solution of the following equation for “sigma_z”, which involves Bessel functions of first and third kind?
Hi Naveed, I am guessing that this is part of the solution for the TE modes in a fiber optic cable. I ran some code and I don'...

7 years ago | 2

| accepted

Answered
Rank function returning two different values to the same matrix
Hi Subash, It's not the same construction process at all. Try it with smaller numbers, and integers: m = 5; n = 4; A = rand...

7 years ago | 2

Answered
Hello, I am new to Matlab and I need help with an error that pops up when I try to run my code. I don't understand why the error "Index exceeds matrix dimensions" pops up for my equation solving for variable D.
Hi Isabel, A couple of things. First, since you want to keep f1 as a vector for the plot, the f1 line in the 'if' statement ne...

7 years ago | 0

Answered
Evaluating normal inverse when probability is close to zero
Hi Mike, Of course there is always the question if the normal pdf could still apply that far out in the tails, but that is assu...

7 years ago | 1

Answered
Want a random matrix which has a negative eigenvalues
Hi Jon, The sum of the eigenvalues of a matrix equals the trace of the matrix. If all eigenvalues are negative their sum would...

7 years ago | 1

Answered
Simple questions on Mechanical Vibrations
Hi y z l, try plot(w,amp) which looks pretty good.

7 years ago | 0

| accepted

Answered
Maximum value of a normalized power changes
Hi pos, First of all, if you want to approximate the area, that's done with intervals and not with points. Just summing the ...

7 years ago | 0

| accepted

Answered
Can someone tell me why my error is so large for my composite simpsons rule?
Hi Briyahna, Yes the Simpson's rule expression is wrong, but only in the typo sense of having a misplaced parenthesis. Inste...

7 years ago | 0

| accepted

Load more