Beantwortet
How to solve a coupled system of differential equations with two derivatives in one equation?
I think the easiest way would be to solve for dx/dt and then use any of the numerical ode functions: dx/dt = x/y+x-x^2 d...

mehr als 11 Jahre vor | 2

Beantwortet
Question about using fzero to find all real roots of a polynomial
*Is it possible to display all of the real roots of this polynomial using the fzero command?* The answer to this question is ...

mehr als 11 Jahre vor | 0

Beantwortet
got stunned and cannot display on commond during using while-loop
1. You used "(1-x./n).^n" instead of the required "(1+x/n)^n", so you can never hope to match elements of 'myVal' with those of ...

mehr als 11 Jahre vor | 2

Beantwortet
how to calculate pdf probabilitity of i.i.d
This is apparently homework. Here's a hint to get you started. If x is the maximum of x1,x2,...,xn, the probability that x <= ...

mehr als 11 Jahre vor | 2

Beantwortet
Three ways to do the same integration leading to three different speeds: why?
As to the difference between method 1 and 2, for each of the million trips through the loop method 2 has to construct and then a...

mehr als 11 Jahre vor | 0

Beantwortet
how do i use for loop to fine determinant of Vandermonde matrix?
Let V be an n-by-n Vandermonde matrix. d = 1; for k = 1:n-1 d = d*prod(V(k+1:n,2)-V(k,2)); end % <-- At exit...

mehr als 11 Jahre vor | 2

| akzeptiert

Beantwortet
Error using round(reshape(message,Mm*Nm,1)./256)
Does 'lena.jpg' produce a third dimension for color? If so, that would account for your error message; you would have more than...

mehr als 11 Jahre vor | 1

Beantwortet
Double & Triple Integration with tabular data
You can use Matlab's 'trapz' successively for this purpose. The easiest case is integrating over a rectangular region in (x,y) ...

mehr als 11 Jahre vor | 2

| akzeptiert

Beantwortet
How to give IF condition in following code?
b = true; while b yt = randi([0,1],W,1); b = (sum(yt)<2); % Repeat if 'yt' has less than two ones end ...

mehr als 11 Jahre vor | 2

| akzeptiert

Beantwortet
how do i find the angle between a vector and a line?
b = [2,5,8]; % vector along line ang = atan2(norm(cross(a,b)),dot(a,b)); % Angle in radians between vectors a and b (N...

mehr als 11 Jahre vor | 1

Beantwortet
two coupled algebraic equations
Multiply each equation by x/k^2. The first equation becomes a quadratic equation in the ratio x/k and the second one becomes a ...

mehr als 11 Jahre vor | 0

Beantwortet
Extract random sample x,y,z data inside the circle
In setting 'view' to view(5,90) which is a view from overhead and referring to cartesian coordinates, a0 and b0, at the center o...

mehr als 11 Jahre vor | 1

| akzeptiert

Beantwortet
error : minus matrix dimention
Hamid, your 'solveq' function is clearly intended only for an 'f' input argument consisting of a column vector, not the 3-by-n s...

mehr als 11 Jahre vor | 1

Beantwortet
How to convert this code without 'goto' statement?
That is code you wouldn't want to use. As it stands the function has no way to exit. Regardless of the results of all the 'if'...

mehr als 11 Jahre vor | 0

Beantwortet
Plotting a function in a range of variable
If you want to do plotting with 'alpha' in the range alpha=0:0.1:2, you should not declare 'alpha' as a symbolic variable. Inst...

mehr als 11 Jahre vor | 2

| akzeptiert

Beantwortet
Can anyone help me with for loops in Matlab?
Here is code for doing selection sorting, Anthony. However, as it stands it works only on a single column vector and does not i...

mehr als 11 Jahre vor | 1

| akzeptiert

Beantwortet
if" function in matrix elements
s = sum(G(:)<=1); if s == 1 C = A+B elseif s == 2 C = A-B else ??? What do you want to happen...

mehr als 11 Jahre vor | 2

| akzeptiert

Beantwortet
How to make Duplicate values
p = cumsum(accumarray(cumsum([1,Q])',1))'; R = W(p(1:end-1)); Note: If you have a zero in Q, the corresponding W value...

mehr als 11 Jahre vor | 3

| akzeptiert

Beantwortet
i was asked to develop a program that will evaluate a function for -0.9<x<0.9 in steps of 0.1 by arithmetic statement, and series allowing as many as 50 terms. however, end adding terms when the last term only affects the 6th significant in answer
You can use a for-loop with a 'break' to generate successive terms and their sum. For each value of x you are required to use, ...

mehr als 11 Jahre vor | 0

Beantwortet
Plot y^2 = x^2 + 1 (The expression to the left of the equals sign is not a valid target for an assignment.)
You can generate this hyperbola plot using hyperbolic functions as parameters: t = linspace(-4,4,500); x = sinh(t); ...

mehr als 11 Jahre vor | 1

Beantwortet
Generating a random variable that has a predefined covariance with other random variable
You haven't stated what you want the variance of X to be. If it is to be 1, the trivial solution would be to set X = e. For ge...

mehr als 11 Jahre vor | 3

| akzeptiert

Beantwortet
User-Defined Selection Sort for 2-D arrays of any size (MATLAB)
function [array2,p] = sortorder(array,col) [~,p] = sort(array(:,col)); array2 = array(p,:); return

mehr als 11 Jahre vor | 3

| akzeptiert

Beantwortet
Replace NaNs with next real value.
Here's another way: t = isnan(x); f1 = find(t); f2 = find(diff([t,false])==-1)+1; f3 = zeros(1,length(f1)); ...

mehr als 11 Jahre vor | 0

Beantwortet
How to solve an equation with piecewise defined function?
Instead of using 'solve' you can use 'fzero' for this problem. Of course this problem is so simple you can do it in your head, ...

mehr als 11 Jahre vor | 2

Beantwortet
hi, i need your help, y''=xy, y(0)=0 and y(0)=1 this second order DE i can solve in power series method i got recurrence relation
I don't agree with your recurrence equation, Jamila. For the series I get: y = x + x^4/(3*4) + x*7/(3*4*6*7) + x10/(3*4*6*...

mehr als 11 Jahre vor | 1

Beantwortet
can i integrate this function using integral?
You haven't shown us your code for using the 'integral' function, but your code for using 'trapz' has the right integrand functi...

mehr als 11 Jahre vor | 1

Beantwortet
Find s, such that det(A+s*D) = d.
If d is real and only real roots are being sought for s, you can simply write a function that accepts a scalar value s and compu...

mehr als 11 Jahre vor | 0

Beantwortet
compute the 2 dimensional (x,y) with respect to time
Let 'a' be the given vector. plot3(a(1:3:end),a(2:3:end),a(3:3:end),'r-')

mehr als 11 Jahre vor | 1

| akzeptiert

Beantwortet
I am having trouble finding the values for a certain variable which contains the "cosh(x)"
The function cosh(x) is defined as (exp(x)+exp(-x))/2 and therefore as x increases in size, the value of cosh(x) increases expon...

mehr als 11 Jahre vor | 2

| akzeptiert

Beantwortet
Creating a function to plot multiple column of a variable in workspace
Just use a for-loop for this purpose: for k = 1:n plot(wavelengtha(:,k), Raman); hold on end What could...

mehr als 11 Jahre vor | 1

| akzeptiert

Mehr laden