Answered
Best Fitness function of GA - Maximisation problem
The ga function is minimising the fitness value, as it should. The values it chose for your parameters will maximise your funct...

6 years ago | 0

Answered
ode 45 question, error message
This: yo(5) = CE0; should probably be: y0(5) = CE0; It likely does not help that ‘o’ and ‘0’ are next to each other on mos...

6 years ago | 0

| accepted

Answered
is anyone know why after I run the file all the code changes to this?
The ‘hw1.m’ file appears to be a MATLAB .mat file that you are attempting to read as a text file. That would normally be approp...

6 years ago | 0

Answered
Rearrange of matrix or vector
Try this: A = [ 1 2 3 4 5 6 7 8 9 ]; B = A; X = [3 7] B([1 2]) = X producing: B = 3 7 3 4 5 6 ...

6 years ago | 0

Answered
Join the curves and make them into one (overlap)
It looks to me that it needs to be plotted in polar coordinates. First, define: i_freq=1:0.1:69; and: i_teta=1:0.1:36; ...

6 years ago | 0

Answered
jacobian ill-conditioned nlinfit
The problem may be because ‘a(1)’ (if the initial estimate is reasonably accurate) is close to the precision limit for floating-...

6 years ago | 0

| accepted

Answered
RANDOM NOISE IN MATLAB
The rand function (uniform distribution) creates random numbers between 0 and 1. The randn function creates normally-distribu...

6 years ago | 1

Answered
Plotting from an array at an interval
There are likely any number of ways to do this. One relatively straightforward way: ExData = [422 1882 1 -0.8 4 ...

6 years ago | 0

| accepted

Answered
Kindly find error in the code
Your code runs for me without error. Note that the magnitudes of columns 3 & 4 are about 1/1000 the amplitude fo columns 1 & 2,...

6 years ago | 0

| accepted

Answered
Is there any log-scale for symbolic functions?
I get Warnings and no line when I try that. I have no idea what the problem could be. Meanwhile, see if this work-around doe...

6 years ago | 0

Answered
Fsolve interchangeable with nlinfit, but how?
It’s not exactly interchangable, however it’s possible to use it to estimate the parameters. Example — x = linspace(0, 10, ...

6 years ago | 0

| accepted

Answered
Scatterplot from .mat file data with loop
Try something like this: Colonies = rand(15,10); %Days = 15, Colonies = 10 MeanColonies = mean(Coloni...

6 years ago | 1

Answered
Equidistant offsets to points on a log scale
I’m not certain what you want. See if my Answer in I cannot get these error bars to work for the life of me describes (and po...

6 years ago | 0

Answered
Help in writing a function
‘which is obviously wrong since gammaT = @(t) A*sin(w*t)+b shoouldn't be define this way.’ Why? It appears to be coded corr...

6 years ago | 1

| accepted

Answered
How can I save date that is overwritten on each loop?
I would record the individual table objects in a cell array, then save them after the loop, if desired: T{i,:} = table(t',...

6 years ago | 1

Answered
How to design a filter to pass frequencies between 0 and 12Hz
If you only want to pass 0 Hz to 12 Hz, and you have R2018a or later, use the lowpass function. If you want to reject those fre...

6 years ago | 0

| accepted

Answered
modifying/rounding/aproximating a number
One option: c = floor(a*1E4)/1E4 producing: c = 2.6598 .

6 years ago | 1

| accepted

Answered
b=fprintf how to
If you want to store the result as ‘b’, use the related function sprintf: b=sprintf('%0.5g\n',a) It is a separate line of cod...

6 years ago | 1

| accepted

Answered
How to reshape the x-axis in this case?
Either: axis tight or: xlim([min(t) max(t)]) should work.

6 years ago | 0

| accepted

Answered
Add markers for stairs() plot, specified amount of makers
Ths stairs funciton will courteously tell what it did if asked. See Create a Stairstep Plot using plot Function.

6 years ago | 0

Answered
How to draw Cuboid of a specific dimension
See if Drawing 3d objects and filling the sides will do what you want.

6 years ago | 0

Answered
plotting frequency response of data in matlab
There is only one column of data, that I assume are the independent variable. You cannot plot its frequency response without an...

6 years ago | 1

| accepted

Answered
I converted double in CSV, but I need the comma at the end of each value
If it absolutely must have commas, it is straightforward to make it happy: x = rand(5,1); fprintf('%.4f,\n', x) producing (i...

6 years ago | 0

| accepted

Answered
Error using fprintf Invalid file identifier. Use fopen to generate a valid file identifier. Function help
Try this: fprintf('E = %23.15E\n',E) Choose the format you want.

6 years ago | 0

Answered
Dealing with large timetables
The only option I can suggest to you is in the timetable documentation section on Extended Capabilities under Tall Arrays. (I h...

6 years ago | 0

| accepted

Answered
sorting table according to date/time
There are problems with the 'InputFormat' format string. Try this: t=datetime(T1T2.TimeStamp,'InputFormat', 'MM/dd/yyyy hh:...

6 years ago | 1

| accepted

Answered
index exceeding array bounds
One option would be to test ‘j’ against the number of rows in the matrix-of-interest, something like this: for j = 1:length(ra...

6 years ago | 0

Answered
Mismatched delimiters relating to log() function?
You have a typo: D(:,:,i) = [Re.^theta(2,i) log(Re.)*theta(1,i)*(Re.^theta(2,i))]; ↑...

6 years ago | 0

Answered
Use fzero() to calculate x required to achieve V/F for every combination of V and F.
The fzero function is a root-finder, so the function it is given to solve must equate to 0 for any delection of independent vari...

6 years ago | 0

| accepted

Answered
How do I fix my legend?
For every plot call, return a handle: h1 = plot(a1,b1,'ko','LineWidth',3); . . . h2 = plot(c1,d1,'bo','LineWidth'...

6 years ago | 0

| accepted

Load more