Risposto
How can I make this program accept input 'value' as only a positive number except for the case 1(where i would like to have both negative and positive numbers as input)?
if a == 1 R = value*5; else if value<0 disp('Value must be positive') else R = v...

oltre 6 anni fa | 0

Risposto
How to convert array of chars examples: '09:56am' or '09:56pm' to number?
As Stephen points out, it is not quite clear what you want to do once you find a string with 'am' or 'pm', but this may get you ...

oltre 6 anni fa | 0

Risposto
Disk out of an arc
Is this what you want? R = 5; x = linspace(R*cos(theta),R,100); y = sqrt (R^2 - x.*x); x = [0,x]; y = [0,y]; ...

oltre 6 anni fa | 1

| accettato

Risposto
How to set up two ODE functions in matlab
You should collect your unknowns P and N in a vector x, and define a function for the right-hand side of your ODE system, someth...

oltre 6 anni fa | 2

Risposto
How can i plot the basic fitting line through the origin (0,0)?
You want to find the slope a of the line <</matlabcentral/answers/uploaded_files/111728/ax.JPG>> that best fits your data...

oltre 6 anni fa | 1

Risposto
How to solve "Subscripted assignment dimension mismatch" error ?
dec2bin(n,m) returns the binary representation of n as a string of m characters, with leading '0'-s as needed. When you assign a...

oltre 6 anni fa | 0

Risposto
How to create the Gas deviation-factor chart for natural gases from Standing and Katz
plot(Ppr,Z); xlabel('Ppr'); ylabel('Z'); legends = cell(10,1); for i = 1:10; legends{i} = sprintf('Tpr = %3...

oltre 6 anni fa | 0

| accettato

Risposto
How can i make my integral more efficient?
I agree that the time gain from my first answer is too small to be of much help in your case. I have tested an alternative appro...

oltre 6 anni fa | 0

| accettato

Risposto
How can i make my integral more efficient?
Using logical indexing instead of find will be faster: relevant = p >= dataset2(d+k,9) & p <= dataset2(d+k,12); dataset2...

oltre 6 anni fa | 0

Risposto
Can I optimise a dynamic model where the objective function is equal just a variable?
What do you mean by 100% full? Is this defined by the hydrogen mass in the car or by the pressure? Either way, you will nee...

oltre 6 anni fa | 1

| accettato

Risposto
I have intraday data in minutes, how can I convert to daily culmulative return
I have now modified the code to use the text file you supplied as input. The format was significantly different from the origina...

oltre 6 anni fa | 0

Risposto
barplot with both plot next to each other?
Adapted from <https://www.mathworks.com/help/matlab/ref/bar.html>: y = [5,4;6,5.5;3.8,3]; bar(y) set(gca,'XTickLabel'...

oltre 6 anni fa | 0

Risposto
Finding important data in txt file
In your case you want to parse all lines containing just numbers into an array (which you may later want to split by e.g.: Px = ...

oltre 6 anni fa | 0

| accettato

Risposto
Get closest x value to y value from a cumulative histogram
If you have access to a toolbox with the prctile function (I don't), that will probably do the job. Alternatively, try this...

oltre 6 anni fa | 0

| accettato

Risposto
Exporting values from Matlab into a Formatted Text File
Here is one way to do it. Note that I collect all the output values in a cell array of strings. First, a sample input file,...

oltre 6 anni fa | 0

Risposto
Figure legend: how to prevent entries from showing?
h = plot(....); legend(h([1,4,7]),'original','proposed','proposed with optimisation')

oltre 6 anni fa | 0

Risposto
How to extract values from tables in the workspace and then plot them in a specific way
Is this what you want? x = [20,30,40]; for i = 1:16; for j = 1:8; figure; plot(x,[Table1(i,...

oltre 6 anni fa | 1

| accettato

Risposto
How to find the maximum point of a line on a plot with multiple lines?
[mx,i] = max(x(:,2)); tmx = t(i); hold on; plot(tmx,mx,'*r')

oltre 6 anni fa | 1

| accettato

Risposto
How do I plot a point at the x intercept on this graph?
Let U be a function of r only and find the solution to U(r) = 0: e=1; sigma=0.154; r=linspace(0.154,1,100); U = @(...

oltre 6 anni fa | 1

Risposto
Run code through multiple excel files
You could try something like this: Names = {'participantNumber';'Ar';'Br';'Xr';'Yr';'RRr';'ZRr';'SBr';... 'SLr';...

oltre 6 anni fa | 0

| accettato

Risposto
How to Compare datetimes with milisecs?
s = 30; % The accuracy you desire (in seconds) close_enough = abs(u1200lab(1,1)-u1300processo(1,1)) < 1/24/3600*s

oltre 6 anni fa | 0

Risposto
Generate synthetic data (or probability distribution object) from user-defined distribution function
Drawing random samples from a given Probability Distribution is excellently explained by Carson Chow at <https://sciencehouse.wo...

oltre 6 anni fa | 1

| accettato

Risposto
I want to plot a set of points satisfying certain condition. Although, there are many points in this set satisfying the given condition, the code I am using plots only the last point. Anyone can help me to plot all these points?
You should specify a marker, since otherwise Matlab tries to plot a line between points. With only one point for each plot stat...

oltre 6 anni fa | 0

Risposto
I'm looking for getting the matlab codes for soving nonlinear differential equations? These equations are from a research paper on HIV AIDS.
Matlab has several functions for integrating systems of differential equation. Type doc ode45 for more information. ...

oltre 6 anni fa | 1

| accettato

Risposto
from acceleration to velocity: problem of integration
I have followed this question, hoping that somebody with better signal processing skills that myself would come up with an elega...

oltre 6 anni fa | 1

Risposto
I am trying to solve a non linear simultaneous equation using NR method.The program does not converges.I know the exact solution and if the initial value is set to exact value then the program converges in one step.
First: Your script parameter_function_matrix.m is a bit confusing, with your exceedingly long expressions. It would be easier t...

oltre 6 anni fa | 0

| accettato

Risposto
How to use ODE solver for a coupled second order ODE?
Convert to four first-order ODEs in x, u,y,v, where u = x', v = y'. The equations are then: A*u' + B*v' = -C*v - D^y + ...

oltre 6 anni fa | 0

Risposto
Extracting column and specific sorted row data from a large text file
fid = fopen('FILE_MATLAB.txt'); Cell_number = []; Slope_Angle = []; Z = []; P = []; for i = 1:4 % Skip heade...

oltre 6 anni fa | 1

Risposto
Create the objective function for fmincon solver using for loop
You are right that the problem lies with the line FUN = @(x) Afun(x) + FUN(x); This defines a recursive function, where ...

oltre 6 anni fa | 1

Carica altro