Beantwortet
Help finding the min and max of a matrix without using min/max commands
Change the two lines max=mat2; min=mat2; to max = -inf; min = inf; Note: It is a poor practice to use ...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Help with iteration!!?
Your while-loop does not seem to be very useful. On the first pass through it sets Wd equal to Wdf and because the "(Wdf-Wd)> 0...

etwa 10 Jahre vor | 0

Beantwortet
To reshape the number of elements must not change matlab error
It looks to me as though your original 'bits' array contains a number of elements other than n*m. You can't change the total nu...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
check points inside triangle or on edge with example
Suppose P1 = [x1,y1], P2 = [x2,y2], and P3 = [x3,y3] are row vectors giving the coordinates of the three vertices of a triangle,...

etwa 10 Jahre vor | 2

| akzeptiert

Beantwortet
Calculate Exponentials WITHOUT built-in exponent function?
Trying to compute x^n using only summation is a terrible method. Surely you would be allowed to use multiplication! ExpVa...

etwa 10 Jahre vor | 1

| akzeptiert

Beantwortet
How to increase the speed of this code?
Try 'ndgrid': [X,Y,Z] = ndgrid(0.01:0.01:1); pts = [Z(:),Y(:),X(:)]; %(Corrected)

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Keep getting error: Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be aware that exceeding your available stack space can crash MATLAB and/or your computer.
Your code is clearly meant to be recursive. However, there is something wrong in the way it is planned. You first call "equili...

etwa 10 Jahre vor | 0

Beantwortet
Monte Carlo Experiment in Huffman
In case you don't have access to a huffman compression algorithm, I would expect in your particular case the huffman encoding wo...

etwa 10 Jahre vor | 0

Beantwortet
How to get the inverse function when it's only 1-1 in certain range?
As you have defined iphi2 it is simply one of the two solutions to a quadratic equation: z = 1-sqrt(1-phi2)

etwa 10 Jahre vor | 0

Beantwortet
I want to make this assignment : Const = log(2)/703 800 000 but i keep getting this error massage, 'Matrix dimensions must agree' and I have no idea what that even means. How do I go about this?
If "730 800 000" is meant to be a three-element row vector you need to write: const = log(2)./[730 800 000]; If "730 80...

etwa 10 Jahre vor | 0

Beantwortet
Error using ==> times Matrix dimensions must agree.
Your vector t is a row vector, that is, presumably 1 by 1024 in size. If there is no complaint in plot(t,x), then x must also b...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to write function that recognizes whether a year (e.g2010) input by user is leap year or not
I recommend you put matlab's 'mod' function to good use. Here is one way: t = mod(y,4)==0 & (mod(y,100)~=0 | mod(y,400)==...

etwa 10 Jahre vor | 0

Beantwortet
How to get rid of the error: Error using horzcat. Dimensions of matrices being concatenated are not consistent.
Both the expressions for A and B are invalid. In A the three quantities zeros(3,3), eye(3,3), zeros(3,1) have a total ...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Solving the following integral in MatLab
If b and c are both nonzero, then as x approaches infinity the factor exp(-c*x/(a-b*x)) approaches exp(c/b) which would be nonze...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
finding four solution in an interval
Use matlab function 'fzero' to find solution to fun = @(x) exp(-2*x).*sin(x+4)-0.4; x = fzero(fun,x0); where x0 is ...

etwa 10 Jahre vor | 0

Beantwortet
Help-Integration of Bessel functions
It is likely that an explicit expression for either of those integrals as functions of 'a' is not known in mathematics and there...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Help-Integration of Bessel functions
Use numerical integration with matlab's 'integral' function or one of the other quadrature functions.

etwa 10 Jahre vor | 0

Beantwortet
Trying to use quad to solve this integral but keep getting error
You've forgotten the dot in your division. It should be: y = @(x)((1.941-24.3*x).^2)./(2.92*(0.02408-x)*(0.01605-x));

etwa 10 Jahre vor | 0

Beantwortet
fill matrix randomly with a specific number of units
The tough part of your requirement is to not duplicate rows. The following while-loop is intended to accomplish that. v =...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
How to generate a random integer betwwen a and b inclusive.
x = 9*rand(n,1)+1; As to "inclusive" this will never give exactly 1 or exactly 10. However if you intended to have an uni...

etwa 10 Jahre vor | 0

Beantwortet
comparing numbers on the same vector
y(1) = true; for k = 2:length(x) y(k) = (max(x(1:k-1))<x(k)); end y = double(y);

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
To reflect a contour plot
If your symmetry is in the left-right direction, then do: contour(V(:,end:-1:1),500); However, that leaves the two imag...

etwa 10 Jahre vor | 0

| akzeptiert

Beantwortet
Using ode45 to solve second order differential system
The same single function 'x' cannot in general satisfy two different differential equations, so you need to solve these equation...

etwa 10 Jahre vor | 0

Beantwortet
Finding angle between thee points
To find the angle rotating counterclockwise from point P1(x1,y1), pivoting around point P2(x2,y2), and ending at point P3(x3,y3)...

etwa 10 Jahre vor | 0

Beantwortet
how to calculate all permutations of ['a' 'b' 'c' ... 'x' 'y' 'z'] just 26 characters, yet combinator.m combinations.m return errors
@John: I think you fail to grasp the enormity of 26 factorial. Suppose one of us could come up with your requested scheme of pr...

etwa 10 Jahre vor | 3

Beantwortet
I am trying to obtain a series of vectors made of elements from a larger vector given they exceed a threshold
It's not clear whether you want those Z elements which exceed some fixed value or those which make up a monotone increasing sequ...

etwa 10 Jahre vor | 0

Beantwortet
How to plot a 3rd order best fit line through 3 sets of data?
How about x1 = [Cv80(:);Cv50(:);Cv30(:)]; y1 = [Cp80(:);Cp50(:);Cp30(:)]; p = polyfit(x1,y1,3); y = polyval(p,x1);...

etwa 10 Jahre vor | 0

Beantwortet
How to solve 5 quadratic equations simultaneously
For that particular set of equations you could take steps to make things easier. Introduce a new unknown 't': t = LIDtot-x...

etwa 10 Jahre vor | 2

| akzeptiert

Beantwortet
When I plot, I only get 5 red dots and a blank graph.
You should make two changes: x = linspace(0, 1, w); (or just linspace(0,1) and get the default hundred points) VR = ...

etwa 10 Jahre vor | 2

Mehr laden