Answered
I want to calculate some function using PSO algoritm. but it doesn't work please help me.
Yu are trying to do element by element multiplication of a vector that has 7 elements (x) by a vector that has 12 elements (G/Gr...

5 years ago | 0

Answered
Loop answers slightly out from correct values
Are the differences significant? We are unable to check all the numbers that went into the calculations given in the text. The...

5 years ago | 2

| accepted

Answered
Help for xtick label
Add this line just above your xticklabels line. hAx1.XTick=[8.3333*10^6 1.25*10^7 1.67*10^7 2.08*10^7 2.5*10^7];

5 years ago | 1

| accepted

Answered
Solving nonlinear equations that include integrals with embedded variables
If Dana's suggestion doesn't work, the following non-symbolic approach does: theta0init = pi/2; theta0 = fzero(@intfn, theta0i...

5 years ago | 0

Answered
how to modify a fitted model
1. To get continuous fit lines, Instead of plot(x1,y1_fit,'r-') do something like x = min(x1):max(x1); y = polyval(p,x); pl...

5 years ago | 0

Answered
how to developed numerical code for collocation method for linear differential equations
I've just noticed you want to use a collocation method. So you proceed as follows % For method of collocation choose a function...

5 years ago | 0

| accepted

Answered
Solve first order nonlinear ODE
The value of x increases far too quickly, and reaches a value beyond the numerics ability to cope with when x(0) > 2. Works ju...

5 years ago | 0

| accepted

Answered
Finding Minimum value of an anonymous function using fminbnd
You don't need fminbnd to find the minimum of G. Just min(G(na)) will do it (or am I missing something?).

5 years ago | 0

Answered
I am trying to store every value into a 1D Array from a for loop
It's difficult to tell exactly what you are trying to do, but perhaps the following is close to what you want: ArrayPhi = zeros...

5 years ago | 0

Answered
How do I fit gaussian function to data whose only information I have is the minimum, maximum and number of data points?
All you can reasonably do is assume the maximum and minimum are a certain number of standard deviations ( say 6 sigma) away from...

5 years ago | 0

Answered
Check for missing argument or incorrect argument data type in call to function 'fit' - using two 1x15 double arrays as an input argument
Here's a way of fitting a simple exponential curve. However, you definitely don't want to use it to extrapolate! year=[1991,19...

5 years ago | 1

Answered
How to solve the following equations for Vc(t)?
Can you do it using the differential form of the relationship between Vc and Ic? Something like the following (obviously, you w...

5 years ago | 0

Answered
How to solve the ODE based 1D heat equation with arbitrary optical heat source term?
Here's a possible solution. I've assumed the temperatures are symmetric about the midpoint. I've extracted data from your file ...

5 years ago | 1

Answered
How to plot a restoration-based envelope in matlab
Here's a "starter for ten"! I've used approximate time intervals: T = t(end)/10; % period - there seem to be 10 periods...

5 years ago | 0

| accepted

Answered
Converting a maximizing problem into a minimizing program using linprog
Minimize -x. The maximum of x will then be the negative of this.

5 years ago | 0

Answered
Plot only equilateral triangles
Here's an alternative approach: e = 0.01; for i = 1:10 xc = rand(1); yc = rand(1); r = rand(1); while r < e/sq...

5 years ago | 1

Answered
Fixed-bed adsorption
Do you just need a finer mesh? See: epsilon = 0.62; % Voidage fraction Kc = 4.5542e-5; % Mass Transfer Coefficient Kl = 2...

5 years ago | 2

| accepted

Answered
Solving LTID system recursively
Matlab indexing begins at 1, so you can't have y(-2), y(-1), y(0) etc. Shift your indexing. y(1) = 2; y(2) = 3; for k = 3: l...

5 years ago | 0

Answered
How to divide each column in array 1 by corresponding column in array 2 and put answers in new array, array 3
Try Transmittance = SPFPMTSignal ./ SkinPMTSignal Notice the dot before the backslash. It means element by element division.

5 years ago | 0

Answered
Write a matrix to txt file
Try this: gamma =[1.85506173843200, 1.00229272121327; 1.74935758533076, 1.00727718522748; 1.54993783446447, 1...

5 years ago | 0

| accepted

Answered
How to solve an equation with the variable on both RHS and LHS?
Like this for example (obviously, you will need to replace my arbitrary data with your actual data): OF = 2.4; wbar = linspace...

5 years ago | 0

| accepted

Answered
How can I generate random Student t numbers?
The easiest way is to use the Statistics toolbox. If you don't have access to that then search Matlab's File Exchange, where th...

5 years ago | 0

Answered
Plot an equation: variable inputs
Just a slight modification of the routine in your previous post is needed! Cfn = @(CdB) 10.^(CdB/20); Mfn = @(C,T) (C./(1-T.*(...

5 years ago | 0

Answered
Why is this break not executing for the summation of pi
PrevSum/pie should tend to 1. abs(PrevSum - pie) should get smaller than 10^-8. Try pie = 0; k = 0; err = 1; while err>10^...

5 years ago | 0

Answered
Solve ODE for variable domain
So you would then call your ode with something like: [x,Y] = ode45(@nozzlesinglebobb, xspan, Y0,[],xstartconica,xfineconica,Ral...

5 years ago | 0

| accepted

Answered
3/8 Simpson's Rule
The result of integrating of your function between 0 and 1 is: I = (exp(1)^2*(2*sin(5)-5*cos(5)) + 5)/29; so relative error is...

5 years ago | 1

Answered
Remembering Variables In for Loop
for i=1:no_of_values x(i)=input(['Enter the value of x_ ',num2str(i)]); y(i)=input(['Enter the value of y_ ',num2str(...

5 years ago | 0

| accepted

Answered
Inline to Anonymous Function
Simply replace your x = inline... etc expression with x = @(t) 5*sin(2*pi*1*t).*exp(-.4*t);

5 years ago | 0

| accepted

Answered
Received Power Vs Distance
If Z is distance then you should probably have Pr=Pt*Gt*Gr*lambda^2./(16*pi^2.*Z.^2); Note the position of the parentheses. I...

5 years ago | 0

| accepted

Answered
plot lines not showing up
You were overwriting P all the time, instead of storing all the values: R=287; r=1.4; Mach=[2:0.5:6]; for i=1:9 M=Mach(...

5 years ago | 0

Load more