Answered
Can someone help me to iterate the equation
Let fzero (link) do the iiteration for you: Mfcn = @(M) (1/M).*(2/2.4*0.4/2.4*M.^2).^(2.4/0.8)-0.3/0.2; [Mval,fval] = fze...

7 years ago | 0

Answered
Superimpose two plots having different vector lengths
You need to make the ‘t’ vector the same length as the ‘dx’ vector. Thje easiest way to do that is to use the same decimation v...

7 years ago | 0

| accepted

Answered
Iterate (repeat) a for-loop n times.
You posted an image of your code, not the code we can copy and run. I would do something like this: x = 0 : 0.01 : 5; . . ...

7 years ago | 0

| accepted

Answered
textscan replaced with textread
From the documentation for textscan: C = textscan(fileID,formatSpec) reads data from an open text file into a cell array, C. ...

7 years ago | 0

Answered
How to draw a perpendicular to a line from a point?
I showed you how to plot a line starting with any point and for any angle and length of line in How to draw a tangent using a po...

7 years ago | 0

| accepted

Answered
How can I return the number of times a specific character occurs in text file?
I created it in Notepad by copying your text to it. Reading it is not trivial, since it apparently contains non-ASCII charact...

7 years ago | 0

Answered
Help solving system of differential equations
Start with this: function dydt = modellingPaper(t,y) % MAPPING: y(1) = N, y(2) = E, y(3) = R, y(4) = A ...

7 years ago | 0

Answered
How to draw a tangent using a point and an angle?
Try this: ad = 89.8412; % Angle (Degrees) tangline = 200*[0 cosd(ad); 0 sind(ad)]; ...

7 years ago | 0

| accepted

Answered
i want the plot as this figure:
If you want to fit a sinusoidal function to your data, see for example: Curve fitting to a sinusoidal function (link).

7 years ago | 0

Answered
Fitting an equation to a non-linear data set
Fit your data by modeling the process that created them, and estimating the parameters of that model. We can probably help if...

7 years ago | 0

| accepted

Answered
error using the cellfun function
The error I get from the code as you posted it is: Error using cellfun Non-scalar in Uniform output, at index 1, output 2. ...

7 years ago | 0

Answered
How to "extract" a variable name to a string ?
Use the inputname (link) function: function plottingFct(quantityToPlot) % Simplified example of what I would like to do figu...

7 years ago | 0

Answered
selective hold on plot
It depends on what you want to do, of course. One option is to simply put a condition on the hold call: for k = 1:4 su...

7 years ago | 0

Answered
Display 3D surface data on a 2D plot
The pol2cart (link) function comes quickly to mind. It would seem to be appropriate.

7 years ago | 0

Answered
decimal places in a string
Your numbers likely retain thier full internal precision, so specify the output format as something like this: strmtx = compos...

7 years ago | 0

| accepted

Answered
How do I use the if else function in a traffic model? -
I would do something like this: percent = 2; while (percent < 0) || (percent > 1) percent=input('What is the fill ratio?...

8 years ago | 0

Answered
How to use meshgrid and contour
I don’t know what you mean by ‘not working’. This (slighty variation on your posted code) works, and shows the contour3 lines...

8 years ago | 0

| accepted

Answered
loading info from one code into another
Your best option is likely to use one or more ‘.mat’ files. See the documentation discussion on Save and Load Workspace Variabl...

8 years ago | 0

Answered
any way to plot scatter-line with different symbol
To reproduce that figure, try this: x = 1:6; y = 1:6; figure plot(x(1:4), y(1:4), '-ok', 'MarkerFaceColor','k') hold on ...

8 years ago | 0

| accepted

Answered
Operands to the || and && operators must be convertible to logical scalar values
The ‘short circuit’ double operators(‘&&’ and ‘||’) only work on logical scalar values. Try this: ins = (xn>=1) & (yn>=1) &...

8 years ago | 0

Answered
Using num2str with negative numbers
It is best to go with cell arrays here: j=0; for i = 0 : 2 : length(numeros)+2 requestID{i+1} = ['i' num2str(numeros...

8 years ago | 1

Answered
How to run a script multiple times changing one variable?
Go with vectorization! Try this: % Using dry diameter in um K=0.5; Dd=0.1; sigma=0.072; T=298.15; Mw=18.01528; Pw=0.9...

8 years ago | 0

| accepted

Answered
Don't know how to fix... Index in position 1 exceeds array bounds (must not exceed 1)
The problem is the ‘Bet’ subscript. It is a (1 x 10) vector, not a matrix, so it should have only one subscript, not two.

8 years ago | 1

| accepted

Answered
Don't know how to fix... Index in position 1 exceeds array bounds (must not exceed 1).
The problem is the ‘Bet’ subscript. It is a (1 x 10) vector, not a matrix, so it should have only one subscript, not two.

8 years ago | 1

| accepted

Answered
How can I solve different equations that depend on different changing values?
As far as plotting them, this seems to work: w = 0.02; % Width of Chip...

8 years ago | 0

Answered
Invalid expression error with function!
Read the coordinates as a string, then do the conversions: prompt = 'Input coordinates between which you want to find the grea...

8 years ago | 0

Answered
Time domain to Frequncy domain signal conversion
Use the Signal Processing Toolbox spectrogram (link) function to do time-frequency analysis.

8 years ago | 0

Answered
Is there a better way of solving simultaneous differential equations then using dsolve as MATLAB crashes everytime I use it?
You have a linear system: so the solution is going to be the matrix exponential: that in MATLAB code is: syms P(t) Lam...

8 years ago | 1

| accepted

Answered
Is it possible to use Simulated Annealing or Genetic Algorithm for parameter estimation of a parametric System of ODEs?
It is definitely possible to use the ga function to estimate the parameters of a system of differential equations. I experiment...

8 years ago | 2

| accepted

Answered
sin function gives straight line when plotting
You are only plotting two points, at x=0 and x=50. Try this instead: x = linspace(0, 50); y1 = 0.25*x.*sin(x); y2 = 0.25*...

8 years ago | 0

Load more