답변 있음
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...

6년 초과 전 | 0

답변 있음
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 ...

6년 초과 전 | 0

답변 있음
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]; ...

6년 초과 전 | 1

| 수락됨

답변 있음
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...

6년 초과 전 | 2

답변 있음
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...

6년 초과 전 | 1

답변 있음
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...

6년 초과 전 | 0

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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...

6년 초과 전 | 0

답변 있음
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...

6년 초과 전 | 1

| 수락됨

답변 있음
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...

6년 초과 전 | 0

답변 있음
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'...

6년 초과 전 | 0

답변 있음
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 = ...

6년 초과 전 | 0

| 수락됨

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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,...

6년 초과 전 | 0

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

6년 초과 전 | 0

답변 있음
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,...

6년 초과 전 | 1

| 수락됨

답변 있음
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')

6년 초과 전 | 1

| 수락됨

답변 있음
Why am I getting error "In an assignment A(:) = B, the number of elements in A and B must be the same." in line 105: T(i+1) = T(i)+(step/6)*(k1_T+2*k2_T+3*k3_T+k4_T); when it is the same as lines above which measure different properties?
Short answer: Use the debugger! For example: Select "Stop on errors" under "Breakpoints" in the editor toolstrip. When th...

6년 초과 전 | 0

답변 있음
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 = @(...

6년 초과 전 | 1

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

6년 초과 전 | 0

| 수락됨

답변 있음
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

6년 초과 전 | 0

답변 있음
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...

6년 초과 전 | 1

| 수락됨

답변 있음
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...

거의 7년 전 | 0

답변 있음
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. ...

거의 7년 전 | 1

| 수락됨

답변 있음
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...

거의 7년 전 | 1

답변 있음
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...

거의 7년 전 | 0

| 수락됨

답변 있음
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 + ...

거의 7년 전 | 0

답변 있음
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...

거의 7년 전 | 1

답변 있음
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 ...

거의 7년 전 | 1

더 보기