Answered

How can I use a string in legend()?

You could use Legend = ['HS+HG = 0.5+5' ;'HS+HG = 1+5']; legend(Legend) But make sure there are the same number of characte...

How can I use a string in legend()?

You could use Legend = ['HS+HG = 0.5+5' ;'HS+HG = 1+5']; legend(Legend) But make sure there are the same number of characte...

7 hours ago | 0

Answered

Inverse hyperbolic fit to data

Here's an alternative, with V as the independent variable and P as the dependent one: % Data P = [5 7.5 10 12.5 15 17.5 20 25...

Inverse hyperbolic fit to data

Here's an alternative, with V as the independent variable and P as the dependent one: % Data P = [5 7.5 10 12.5 15 17.5 20 25...

11 hours ago | 1

Answered

make a function recursive (koch snowflake)

The following replaces the "for iteration = 1:n" loop with a recursive function %Koch draws Koch snowflake %n is how many iter...

make a function recursive (koch snowflake)

The following replaces the "for iteration = 1:n" loop with a recursive function %Koch draws Koch snowflake %n is how many iter...

1 day ago | 0

Answered

What is wrong with my code?

Your code works if you put in sensible numbers for step size and velocity. Zero is not sensible!

What is wrong with my code?

Your code works if you put in sensible numbers for step size and velocity. Zero is not sensible!

1 day ago | 0

Answered

How can I solve it: Matrix dimensions must agree.

Replace if M ==[] with if isempty(M)

How can I solve it: Matrix dimensions must agree.

Replace if M ==[] with if isempty(M)

1 day ago | 0

| accepted

Answered

Getting a wrong answer using solve()

Running your code as is (I copied and pasted, with no changes), I get >> syms pa p1a; c=1.056; Eq1= -8 * p1a ^ 2 + (12 * c -...

Getting a wrong answer using solve()

Running your code as is (I copied and pasted, with no changes), I get >> syms pa p1a; c=1.056; Eq1= -8 * p1a ^ 2 + (12 * c -...

1 day ago | 1

Answered

Best fit line on Semi log graph

Like so data=[0.891 35784.525582 0.91 39142.72 0.815 17679.26 0.891 25582 0.8861 30168.052]; ...

Best fit line on Semi log graph

Like so data=[0.891 35784.525582 0.91 39142.72 0.815 17679.26 0.891 25582 0.8861 30168.052]; ...

1 day ago | 1

| accepted

Answered

How to Plot a Fourier Series?

Here's the cosine version. You can add the sin version and play with different ranges for n: x = -24:0.1:24; n = 10; ycos = f...

How to Plot a Fourier Series?

Here's the cosine version. You can add the sin version and play with different ranges for n: x = -24:0.1:24; n = 10; ycos = f...

2 days ago | 0

| accepted

Answered

How to plot an implicit and dicontinues function?

Do you mean like this (type doc contour for more detail): x1 = -2:0.01:2; x2 = -2:0.01:2; [x, y] = meshgrid(x1, x2); z = T...

How to plot an implicit and dicontinues function?

Do you mean like this (type doc contour for more detail): x1 = -2:0.01:2; x2 = -2:0.01:2; [x, y] = meshgrid(x1, x2); z = T...

2 days ago | 0

| accepted

Answered

Multiple roots formula with Matlab

I think your formula shoud be First define your function and its first two derivatives in Matlab f = @(x) x.^4- 6*x.^3 + 12*...

Multiple roots formula with Matlab

I think your formula shoud be First define your function and its first two derivatives in Matlab f = @(x) x.^4- 6*x.^3 + 12*...

2 days ago | 0

| accepted

Answered

How to plot an implicit and dicontinues function?

Something like the following? (You could use surfc if you want contours as well): x1 = -10:10; x2 = -10:10; [x, y] = meshgr...

How to plot an implicit and dicontinues function?

Something like the following? (You could use surfc if you want contours as well): x1 = -10:10; x2 = -10:10; [x, y] = meshgr...

2 days ago | 0

Answered

plotting the graph, help me~~

You had a few mismatches between vgs and Vgs. Matlab is case sensitive. Try W=40; Vth=0.45; Leff=0.15; k=4.255*(10^-4)*(W/L...

plotting the graph, help me~~

You had a few mismatches between vgs and Vgs. Matlab is case sensitive. Try W=40; Vth=0.45; Leff=0.15; k=4.255*(10^-4)*(W/L...

2 days ago | 0

| accepted

Answered

Recursive Function in Matlab (Help)

The Newton_Raphson is a recurrence formula, not a recursive one, so what you have written is correct. Look at the last value o...

Recursive Function in Matlab (Help)

The Newton_Raphson is a recurrence formula, not a recursive one, so what you have written is correct. Look at the last value o...

2 days ago | 0

Answered

NUMERICAL INTEGRATION USING SIMPSONS

The problem is that you have many values of lambda. To deal with this use a loop to do the integration for each value of lambda...

NUMERICAL INTEGRATION USING SIMPSONS

The problem is that you have many values of lambda. To deal with this use a loop to do the integration for each value of lambda...

2 days ago | 0

| accepted

Answered

non linear implicit equation

Surprisingly, this has an explicit solution for y (I didn't use Matlab to get it as I don't have the symbolic toolbox to hand) ....

non linear implicit equation

Surprisingly, this has an explicit solution for y (I didn't use Matlab to get it as I don't have the symbolic toolbox to hand) ....

3 days ago | 1

| accepted

Answered

How to write the codes for this gamma function?

Compare your coded value of 154056.7 with the equation's value of 154.056.

How to write the codes for this gamma function?

Compare your coded value of 154056.7 with the equation's value of 154.056.

3 days ago | 0

Answered

Poisson Boltzmann eq. with an infinite boundary condition

I suspect the initial gradient required to get zero at infinity is an irrational number (or possibly a rational number with a la...

Poisson Boltzmann eq. with an infinite boundary condition

I suspect the initial gradient required to get zero at infinity is an irrational number (or possibly a rational number with a la...

3 days ago | 0

| accepted

Answered

How to solve s system of coupled nonlinear ODES already given the state vector

You need to solve for all xdots simultaneously - this is done in matrix format below. There were also a number of errors in you...

How to solve s system of coupled nonlinear ODES already given the state vector

You need to solve for all xdots simultaneously - this is done in matrix format below. There were also a number of errors in you...

4 days ago | 1

| accepted

Answered

Generate and Plot N Points Picking Random Points on Triangle

More like the following; rng('shuffle'); n = 1000; % Set number of points as desired % Let (0,0) be vertex 1, (0,2) be verte...

Generate and Plot N Points Picking Random Points on Triangle

More like the following; rng('shuffle'); n = 1000; % Set number of points as desired % Let (0,0) be vertex 1, (0,2) be verte...

4 days ago | 0

| accepted

Answered

Finding the streamlines of a complex potential for a Joukowsky transform from a unit circle to a flat plate.

x=0:. There was a strange vertical line that O thought was related to this. However, you could put it back and see if it makes a...

Finding the streamlines of a complex potential for a Joukowsky transform from a unit circle to a flat plate.

x=0:. There was a strange vertical line that O thought was related to this. However, you could put it back and see if it makes a...

4 days ago | 1

Answered

Finding the streamlines of a complex potential for a Joukowsky transform from a unit circle to a flat plate.

There are some typos in the paper by Smith et al, and some steps left out. I think the following generates figure 18: x = [-2:...

Finding the streamlines of a complex potential for a Joukowsky transform from a unit circle to a flat plate.

There are some typos in the paper by Smith et al, and some steps left out. I think the following generates figure 18: x = [-2:...

4 days ago | 1

| accepted

Answered

How to do write the codes for this summation problem?

Having defined n and T then B = 1./(log(T) - mean(log(T))); Note that in Matlab, log is log to base e.

How to do write the codes for this summation problem?

Having defined n and T then B = 1./(log(T) - mean(log(T))); Note that in Matlab, log is log to base e.

4 days ago | 0

Answered

how to graph this system of questions into mathlab

You can define the function as follows f = @(v) (-0.001778*v.^2+0.05333*v).*(v<30); The (v<30) part simply multiplies the rest...

how to graph this system of questions into mathlab

You can define the function as follows f = @(v) (-0.001778*v.^2+0.05333*v).*(v<30); The (v<30) part simply multiplies the rest...

4 days ago | 0

Answered

Initialize values at time = 0

You probably want to replace if (lambda(:,1) == lambda(1,1)) & (lambda(:,2) == lambda(1,2)) by if (lambda(r,1) == lambda(1,1)...

Initialize values at time = 0

You probably want to replace if (lambda(:,1) == lambda(1,1)) & (lambda(:,2) == lambda(1,2)) by if (lambda(r,1) == lambda(1,1)...

5 days ago | 0

| accepted

Answered

ode arguments error in function

For the last line in your function you need dYfuncvecdW = [dXdW; dydW]; Notice the semicolon after dXdW Also your plot comman...

ode arguments error in function

For the last line in your function you need dYfuncvecdW = [dXdW; dydW]; Notice the semicolon after dXdW Also your plot comman...

5 days ago | 0

Answered

How do I solve Time dependent parameter in ODE

Perhaps your code needs to be structured more along the following lines; tspan = ..... y0 = ..... options = ..... [t, ymod...

How do I solve Time dependent parameter in ODE

Perhaps your code needs to be structured more along the following lines; tspan = ..... y0 = ..... options = ..... [t, ymod...

5 days ago | 0

| accepted

Answered

How to plot min and max values on graph

If you meant you want to highight all the peaks and troughs then the following will do it (assuming you haven't got the findpeak...

How to plot min and max values on graph

If you meant you want to highight all the peaks and troughs then the following will do it (assuming you haven't got the findpeak...

6 days ago | 0

Answered

Plotting a rankine half body

Try this m=3; %strength U = 20;%positive x-axis %Mesh for fourth quadrant and corresponding stream value function [X1,Y1] = ...

Plotting a rankine half body

Try this m=3; %strength U = 20;%positive x-axis %Mesh for fourth quadrant and corresponding stream value function [X1,Y1] = ...

6 days ago | 1

| accepted

Answered

Integration by numerical methods

Something like this: z = 0.01:0.01:1; I = zeros(1,numel(z)); for i = 1:numel(z) I(i) = integral(@(x) sqrt(x)./(exp(x)./z(i) ...

Integration by numerical methods

Something like this: z = 0.01:0.01:1; I = zeros(1,numel(z)); for i = 1:numel(z) I(i) = integral(@(x) sqrt(x)./(exp(x)./z(i) ...

7 days ago | 0

| accepted