Risposto
How to insert the mean in a plot?
If you signal data is in vector y, say, then ymean = mean(y); ystddev = std(y); yhi = ymean+ystdev; ylo = ymean-ystdev; xr...

circa 6 anni fa | 1

| accettato

Risposto
plotting the data on land only
Replace the values less than zero by NaNs, then use the surf command. Something like the following perhaps: ix = WH<0; WH(ix)...

circa 6 anni fa | 0

Risposto
ellipse fitting with matlab using fittype
Have a look here: https://uk.mathworks.com/help/curvefit/fittype.html?s_tid=srchtitle It shows you how to construct your own fu...

circa 6 anni fa | 1

Risposto
Help plotting a curve according to specific conditions of a variable
You mean like this? theta = linspace(0, 2*pi, 360); theta1=theta; theta1(180:end) = -theta(180:end); plot(rad2deg(theta), ra...

circa 6 anni fa | 0

| accettato

Risposto
Histogram to a CDF/PDF
You can get a CDF as follows: % Modified Kaplan-Meier CDF % assumes each point is representative of 1/N of the population. ...

circa 6 anni fa | 0

Risposto
How to convert continuous variable into discrete variables?
How about this load('DATA.mat'); X3(1) = []; % the first values for X3 and Y are NaNs, so they are removed here Y(1) = []; ...

circa 6 anni fa | 0

Risposto
How to stop my iteration Tn(j,i)=Tn+1(j,i)
Replace your for loop by: tol = 10^-6; % Or whatever is appropriate err = 1; while err>tol Told = T; for i=2:nx-...

circa 6 anni fa | 0

| accettato

Risposto
How to find the vaule of a 2-D plot at certain point
Use interp1 to interpolate between known values. Of course you can't guarantee exact values unless you know the exact form of t...

circa 6 anni fa | 0

| accettato

Risposto
Splitting a position vector into X & Y then plotting them
Soething like this (needs your data to get a sensible solution): m = 1; rho = 1; Cd = 1; S = 1; g = 9.8; % Replace with your va...

circa 6 anni fa | 0

| accettato

Risposto
Two vectors into matrix with an opeartion?
Like this: a = [0 1 2 3]; b = [6; 7; 8; 9]; % Note that b is a column vector and a is a row vector A = repmat(a,4,1) A = ...

circa 6 anni fa | 0

| accettato

Risposto
How do I use muller method for solving multivariable equations?
I guess there are a few options. If you have the Opimisation toolbox, use fsolve. In your second equation replace V^2 + W^2 b...

circa 6 anni fa | 0

Risposto
Amplifier Model with Varying Input Amplitude
To plot the x-axis in MHz: plot(xaxis*10^-6, X_mag1); For dB you need 20*log10(... as log is base e, log10 is base 10. I ...

circa 6 anni fa | 0

Risposto
Storing values from a for loop
Something like ... k = 0; for h0= -2:0.04:1; k = k+1; h=ones(size(x))*h0;Int=pchip(x,y);xx=linspace(x(1),x(end),500); yy=y...

circa 6 anni fa | 0

| accettato

Risposto
trapz or integral which one is more accurate?
integral is more accurate here. Try x = linspace(0,100,1000); and you will find the trapz result reduces to get much closer t...

circa 6 anni fa | 1

| accettato

Risposto
How to use fsolve with input from an array
Presumably you want to find x(1) and x(2) given values for y(1) and y(2). If so, then you can simply solve them as follows: t ...

circa 6 anni fa | 0

Risposto
I want these kinetic models to fit in MATLAB but I don't know how to proceed. I am in real worry. If anyone can solve/code, it would be of great help. Thanks a million!!
You need to define Haldane as follows (your text-book expression is misleading) Haldane = @(S) 0.478*S / ((1.137 + S) .* (1 + (...

circa 6 anni fa | 0

| accettato

Risposto
Solve numerical equation with Y at both sides
Your equation can also be expressed as a quadratic in Y which could be solved using roots (for specified values of x). You...

circa 6 anni fa | 1

Risposto
Plot 3D implicit function
This is because your function is never zero with the constants you've used. Try setting c0 = 1.

circa 6 anni fa | 0

Risposto
How to convert continuous variable into discrete variables?
Does the following do what you want? X3 = 0:0.05:0.6; Ydiscrete = zeros(length(X3)); for i = 2:length(X3) ix = find(X3(i...

circa 6 anni fa | 0

Risposto
How to show results of for end values as a vector.
h0 = 0:2; h = h0.*2

circa 6 anni fa | 0

| accettato

Risposto
Solving Elliptic Integral Numerically
The method is basically a slight modification of the Newton-Raphson method for finding algebraic roots. In one dimension Newton...

circa 6 anni fa | 1

Risposto
Solving System of Nonlinear Differential equations
The following structure is what you need (notice that the second order ode is turned into two first order ones); R0 = 1; K0 = ...

circa 6 anni fa | 1

| accettato

Risposto
empty sym error, how to solve
You could use fzero: P10 = -100; P1 = fzero(@fn, P10); function F = fn(P1) g=9.807; p=1000; V1=0; ...

circa 6 anni fa | 0

| accettato

Risposto
Solving Elliptic Integral Numerically
The following gets close: % Basic data b=.0304; F=4; E1=200e9; L1=.2; h1=.001; I1=b*h1^3/12; E2=200e9; L2=.1; h2=....

circa 6 anni fa | 2

| accettato

Risposto
Define formulas for ODE input
Here's one way: % d^2A/dy^2 + C*(dA/dy) - C*dB/dy = 0 % dB/dy = 1/C*f(B) % Turn the 2nd order ODE inot two 1st order ones % ...

circa 6 anni fa | 0

| accettato

Risposto
How to find my ode45 equation in specific h
Something like this perhaps: tspan = 0:120; h0=2; [t, h] = ode45(@rate, tspan, h0); tx = interp1(h,t,1); plot(t,h,tx,1,'o'...

circa 6 anni fa | 0

| accettato

Risposto
Finite Differences using fsolve for non linear equations
Do you need fsolve at all? Doesn't your blayer function do the solving itself? Couldn't you simply have nx = 10; ny = 10; L ...

circa 6 anni fa | 0

Risposto
advanced Heatmap plotting question
The following will do it, though there are probably neater ways to do the colouring: load('data.mat') x = Z0(:,1); y = Z0(:,2)...

circa 6 anni fa | 0

Risposto
I want to plot a line but got a curve
Just t = (0:0.01:0.64)'; a = -9.81*ones(size(t)); plot(t,a) gives a horizontal line.

circa 6 anni fa | 0

Risposto
fitting data with exponential + linear form
Try starting with the following guesses: a = 6E10, b = 4E-4, c = 0, d = -1.57E12. with explinearfit = fittype( @(a,b,c,d,x)...

circa 6 anni fa | 0

Carica altro