Answered

Why does solve function return an empty value in a for cycle?

You have cubic equation It means that you have 3 roots try T_gp_out(i)=double(sol(1)); % choose first root

Why does solve function return an empty value in a for cycle?

You have cubic equation It means that you have 3 roots try T_gp_out(i)=double(sol(1)); % choose first root

18 hours ago | 0

| accepted

Answered

ODE error message "Error using exist The first input to exist must be a string scalar or character vector"

Try this way: prepare function handle for ode45 solver fin = @(t,no) k1*o*n2-k_1*no*((k1*o*n2+k_2*no*o+k_3*no*h)/(k_1*no+k2*o2+...

ODE error message "Error using exist The first input to exist must be a string scalar or character vector"

Try this way: prepare function handle for ode45 solver fin = @(t,no) k1*o*n2-k_1*no*((k1*o*n2+k_2*no*o+k_3*no*h)/(k_1*no+k2*o2+...

19 hours ago | 0

Answered

Problem longitude and latitude contour in a surface plot

Sure, use meshgrid [m,n] = size(bat_latitude); xx = linspace(1,n,40); yy = linspace(1,m,144); [x1,y1] = meshgrid(xx,yy); [x...

Problem longitude and latitude contour in a surface plot

Sure, use meshgrid [m,n] = size(bat_latitude); xx = linspace(1,n,40); yy = linspace(1,m,144); [x1,y1] = meshgrid(xx,yy); [x...

21 hours ago | 0

Answered

Regarding improving efficiency of the code using fzero and int (integral) function in for loop

I tried to plot your function c1 = .9; c2 = 0.7; c3 = 0.6; x = -1:0.1:1; f = @(x) c1 - exp(c2*x).*(1-c3*x); plot(x,f(x))...

Regarding improving efficiency of the code using fzero and int (integral) function in for loop

I tried to plot your function c1 = .9; c2 = 0.7; c3 = 0.6; x = -1:0.1:1; f = @(x) c1 - exp(c2*x).*(1-c3*x); plot(x,f(x))...

1 day ago | 0

Answered

Error using vertcat. Dimensions of arrays being concatenated are not consistent.

Make sure that all your spaces correct Here is example [1 -1; 1 2] % ok [1 - 1; 1 2] % error

Error using vertcat. Dimensions of arrays being concatenated are not consistent.

Make sure that all your spaces correct Here is example [1 -1; 1 2] % ok [1 - 1; 1 2] % error

1 day ago | 0

| accepted

Answered

"Scattered Interpolant" produces invalid values

Here are some of your data scatter3(ALT,MACH,TH,20,TET,'fill') I used slice to see how the interpoalted data looks [x,y,z] ...

"Scattered Interpolant" produces invalid values

Here are some of your data scatter3(ALT,MACH,TH,20,TET,'fill') I used slice to see how the interpoalted data looks [x,y,z] ...

1 day ago | 0

Answered

Symbolic differential equation problem

The problem is in z_c variable z_c = z - z*exp(-t/r) z(t) should be instead of z try to change this line z_c = subs(z_c,[r ...

Symbolic differential equation problem

The problem is in z_c variable z_c = z - z*exp(-t/r) z(t) should be instead of z try to change this line z_c = subs(z_c,[r ...

2 days ago | 0

| accepted

Answered

who can i plot streamlines on a disk

i don't know why !!! if i take [X,Y]=meshgrid(-6:0.005:6); instead of the circular meshgrid i didn't get any error. Probably be...

who can i plot streamlines on a disk

i don't know why !!! if i take [X,Y]=meshgrid(-6:0.005:6); instead of the circular meshgrid i didn't get any error. Probably be...

2 days ago | 0

| accepted

Answered

How do I Interlace / Interleave 3 or more Matrices in MATLAB ?

See if this works ar = cellfun(@(x)size(x,2),data); % number of columns in each matrix mm = size(data{1},1); ...

How do I Interlace / Interleave 3 or more Matrices in MATLAB ?

See if this works ar = cellfun(@(x)size(x,2),data); % number of columns in each matrix mm = size(data{1},1); ...

2 days ago | 0

Answered

Solving system of equations

Here is a simple example. I hope it's clear enough. TR, TL, TD - boundary conditions (right, left and down boundaries)

Solving system of equations

Here is a simple example. I hope it's clear enough. TR, TL, TD - boundary conditions (right, left and down boundaries)

2 days ago | 0

Answered

Share data between two functions

What abuo this? function [hyspar1,status] = myOutputFcn(t,sol,flag,hyspar) switch flag case 'init' ...

Share data between two functions

What abuo this? function [hyspar1,status] = myOutputFcn(t,sol,flag,hyspar) switch flag case 'init' ...

3 days ago | 0

Answered

x Centroid of area between function and x-axis

Try this f = @(x) x.^2; f1 = @(x) x.*f(x); A = integral(f,a,b); B = integral(f1,a,b); c = B/A;

x Centroid of area between function and x-axis

Try this f = @(x) x.^2; f1 = @(x) x.*f(x); A = integral(f,a,b); B = integral(f1,a,b); c = B/A;

3 days ago | 1

Answered

fill legend rectangles with color

Try this example surf(peaks,'facecolor','none') % plot peaks surface(membrane,'facecolor','none') % plot membrane ...

fill legend rectangles with color

Try this example surf(peaks,'facecolor','none') % plot peaks surface(membrane,'facecolor','none') % plot membrane ...

3 days ago | 1

| accepted

Answered

calculating monthly average from matrix

Try this k = 1; month(end+1,:) = month(end,:)*nan; s = 0; for i = 1:length(month)-1 s = s + value(i); if month(i) ...

calculating monthly average from matrix

Try this k = 1; month(end+1,:) = month(end,:)*nan; s = 0; for i = 1:length(month)-1 s = s + value(i); if month(i) ...

3 days ago | 0

| accepted

Answered

fast delete of rows in a table

Write indices and delete outside the for loop ind = logical(db*0); for i=1:(size(db,1)-1) if db.INTERVENTION(i)==1 && is...

fast delete of rows in a table

Write indices and delete outside the for loop ind = logical(db*0); for i=1:(size(db,1)-1) if db.INTERVENTION(i)==1 && is...

3 days ago | 0

Answered

about system 2nd order DE solver using matlab

Everything looks great except of these lines Why did you divide that lines by 10?

about system 2nd order DE solver using matlab

Everything looks great except of these lines Why did you divide that lines by 10?

4 days ago | 0

Answered

system of differential equations

Here is the problem: there is second derivative of , but there is no expression for Looks like 4 variables, but only 3 equat...

system of differential equations

Here is the problem: there is second derivative of , but there is no expression for Looks like 4 variables, but only 3 equat...

4 days ago | 0

Answered

ODE45 Question Not Enough Input Argument

The problem is in this line [t, z] = ode45 (@(t, z) rhs_trajectory(z, g),... [0 tf], z0, opts); Your rhs_traj...

ODE45 Question Not Enough Input Argument

The problem is in this line [t, z] = ode45 (@(t, z) rhs_trajectory(z, g),... [0 tf], z0, opts); Your rhs_traj...

4 days ago | 0

Answered

Visualising 3D Cubes with a colour map

Here is the idea: create cylinder but only for theta = 0:90:360 make modifications Change X,Y data ...

Visualising 3D Cubes with a colour map

Here is the idea: create cylinder but only for theta = 0:90:360 make modifications Change X,Y data ...

4 days ago | 1

| accepted

Answered

How to perform an animation of a 5bar parallel link (this is a 2D plot of a 5 bar link) in matlab?

I have similar code (attached) some explanations: Ask if something is needed

How to perform an animation of a 5bar parallel link (this is a 2D plot of a 5 bar link) in matlab?

I have similar code (attached) some explanations: Ask if something is needed

5 days ago | 0

Answered

Plotting output of the ode solver for different initial conditions

Here is the solution

Plotting output of the ode solver for different initial conditions

Here is the solution

5 days ago | 1

| accepted

Answered

In labelled binary image, fill the blobs with different colors defined by me.

use bwselect to select specific blob. Assign pixels value: red - 1, green - 2, blue - 3 create your own colormap and use it to ...

In labelled binary image, fill the blobs with different colors defined by me.

use bwselect to select specific blob. Assign pixels value: red - 1, green - 2, blue - 3 create your own colormap and use it to ...

5 days ago | 0

| accepted

Answered

Confusion with interp3 and interpn

here is an example [x,y] = meshgrid(1:5); z = x.^2 + y.^2/2; [x1,y1] = meshgrid(1:0.5:5); z1 = interp2(x,y,z,x1,y1); % ...

Confusion with interp3 and interpn

here is an example [x,y] = meshgrid(1:5); z = x.^2 + y.^2/2; [x1,y1] = meshgrid(1:0.5:5); z1 = interp2(x,y,z,x1,y1); % ...

5 days ago | 0

Answered

can it be possible to use odeVectorField

Try this clc,clear syms f(x) g(x) h(x) x Y Pr=10; Le=10; Nt=.1; Nb=.1; [V,y1] = odeToVectorField( diff(f,3) - diff(...

can it be possible to use odeVectorField

Try this clc,clear syms f(x) g(x) h(x) x Y Pr=10; Le=10; Nt=.1; Nb=.1; [V,y1] = odeToVectorField( diff(f,3) - diff(...

6 days ago | 0

Answered

Plot 3D cylindrical voxels filled or empty (boolean)

I draw your data clc,clear cla load example.mat [m,n,k] = size(diff); [r,t,z] = ndgrid(1:m,1:n,1:k); [x,y] = pol2cart(t,r)...

Plot 3D cylindrical voxels filled or empty (boolean)

I draw your data clc,clear cla load example.mat [m,n,k] = size(diff); [r,t,z] = ndgrid(1:m,1:n,1:k); [x,y] = pol2cart(t,r)...

6 days ago | 1

| accepted