Community Profile

# Davide Masiello

### Paul Scherrer Institut (PSI)

Last seen: 10 Tage vor Aktiv seit 2017

Programming Languages:
MATLAB
Spoken Languages:
English, Italian
Professional Interests:
Chemical Kinetics, Fluid Dynamics, Chemical Engineering, Heat and Mass Transfer

#### Statistiken

All

Abzeichen anzeigen

#### Content Feed

Anzeigen nach

Beantwortet
Solving simultaneous set of differential equations for range of values to get desired set output
I'd recommend taking a look at the material at the following link https://ch.mathworks.com/help/matlab/math/boundary-value-prob...

etwa 2 Monate vor | 0

Beantwortet
Draw 1 hyperboloid with equation -0.2x^2 - 0.2y^2 +z^2 =1 with colormap jet
[x,y] = meshgrid(linspace(-10,10,100)); z = sqrt(1+0.2*x.^2+0.2*y.^2); Then you can plot it in many ways. Examples figure...

etwa 2 Monate vor | 0

Beantwortet
ODE simulation: issue with the size of arrays
In addition to my comment above, here's a solution to your problem. It's based on the fact that you can specify tspan as a vect...

etwa 2 Monate vor | 0

Beantwortet
How to do custom equation (non linear) regression?
Assume these are your experimental data x = linspace(0,20,30); y = rand(size(x))/3+(pi*x.^(sqrt(2)/2))./(26.1-x); figure(1) ...

etwa 2 Monate vor | 0

Beantwortet
help with curve fitting with a data function
Just needed better initial guesses, I think data = readmatrix('ottica10.txt'); M = 2; myfun = @(p,x) 1/M*exp(-p(1)*0.5*x).*ab...

etwa 2 Monate vor | 0

| akzeptiert

Beantwortet
Hello! How to define on which plane lies a given point with coordinates? I have coordinates of plane and normal
Four points can be verified to belong on the same plane if the determinant of the matrix is equal to zero. I'd translate tha...

etwa 2 Monate vor | 0

Beantwortet
Interpolation of given data in 2d domain
Example xdata = linspace(1,10,10) ydata = linspace(0,1,11) zdata = rand(length(ydata),length(xdata)) x0 = [2.5 3.5 4.5 5.5];...

2 Monate vor | 0

Beantwortet
How to include NaN elements in an array based on a condition?
a = [2 4 6 12 14 18]; A = a(1):2:a(end); new_a = zeros(size(A)); idx = any(a'== A,1); new_a(idx) = a; new_a(~idx) = nan; n...

2 Monate vor | 0

| akzeptiert

Beantwortet
Minimize the sum of squared errors between the experimental and predicted data in order to calculate two parameters
You can use MatLab's fmincon. z = [0.006;0.012;0.018;0.024;0.03;0.046;0.069;0.091;0.122;0.137;0.152;0.162]; u_exp = [0.709...

2 Monate vor | 0

| akzeptiert

Beantwortet
Why do I receive "Not enough input arguments"? or How can I better code this ODE?
Here's a correct version of your code. 1) Time span and initial conditions must be in the same file as the ode solver, not sure...

3 Monate vor | 1

Beantwortet
I have solved a set of three coupled odes in MATLAB. I have to plot another function which is a function of one of these odes. How this can be done?
If none of the differential equations you are solving depends on deln, then you can compute it after solving the ODE system. To...

3 Monate vor | 1

| akzeptiert

Beantwortet
In this code, I want to find out slope at every value of x?
You could use the gradient function provided by MatLab. x=[10.33 10.331 10.332 10.333 10.334 10.335 10.336 10.337 10.338 10.339...

3 Monate vor | 0

Beantwortet
How to plot scatter plot with conditions?
data = readmatrix('table.xlsx'); time = data(:,1); PW = data(:,2); You can identify all the indexes for which the differenc...

3 Monate vor | 0

| akzeptiert

Beantwortet
How do I exclude values in linspace?

3 Monate vor | 0

Beantwortet
Loop over initial guesses with fsolve
Try with func=@f; x0=[1:0.1:1.9;1:0.1:1.9;1:0.1:1.9;1:0.1:1.9;0.01:0.01:0.1;0.01:0.01:0.1;0.01:0.01:0.1]; x = zeros(10,7); ...

4 Monate vor | 1

| akzeptiert

Beantwortet
Help with numerical integral
I guess this is what you're looking for e=0.1; f=@(x)exp(x)./(1+x); a=0.5; b=1.1; n=2; h=(b-a)/n; i=1:1:n-1; S=f(a...

4 Monate vor | 0

Beantwortet
Legend with certain number of rows and columns
Use legendflex from file exchange. x = linspace(0,1,1000); n = (1:6)'; y = x.^n; p = plot(x,y); title('y = x^n') legendf...

4 Monate vor | 1

| akzeptiert

Beantwortet
Creating a row vector of combinations?
You could use nchoosek. The example below is from -3 to 3 for memory issues (you'll generate a humongous matrix). Just substitut...

4 Monate vor | 0

| akzeptiert

Beantwortet
How to remove the zeros from the array upon breaking out of the for loop?
Would this suit your purpose? RHo = 0.5; % Relative Humidity air [%] M= 0.018; % molar mass of water mol...

4 Monate vor | 0

Beantwortet
How o define two different data set of (t , T) for an ode solver that it's variables are (t , C)?
I think your code is fine, below you can see a slightly different approach that uses interpolation to define the T(t) dependence...

4 Monate vor | 0

| akzeptiert

Beantwortet
Create a row vector comparing strings in a for loop
index = []; s1 = { 'FMO1','FMO2','FMO3','FMO4', 'BAO1', 'BAO2', 'BAO3', 'BAO4'}; s2 = {'mean','FMO1','BAO4','FMO2'}; for k =...

5 Monate vor | 0

| akzeptiert

Beantwortet
Plot u=f(x,y,z) with all discrete data
x = rand(1,100); y = rand(1,100); z = rand(1,100); u = rand(1,100); scatter3(x,y,z,20,u,'filled') colorbar

5 Monate vor | 0

Beantwortet
How can i delete max values for each 5 rows in vector
The following code will apply to any lenght of A and any length N of window from which to delete the maximum, provided that leng...

5 Monate vor | 0

Beantwortet
Why the out varies largely in fixed versus variable time step?
That is because the fixed time step is not able to resolve the very steep change in the variable value that is clearly shown in ...

6 Monate vor | 0

| akzeptiert

Beantwortet
Find elements having a specific row and column numbers in a matrix
If the answer is the diagonal, then I'd use the diag function. However, if you are still interested in generalizing the code, y...

6 Monate vor | 0

Beantwortet
How can we plot different signals S1 S2 and S3 on same y-axis with different values? I have attached a figure for reference.
Assume you have three signals which may overlap when plotted like so x = linspace(154,157,100); s1 = rand(1,100); s2 = rand(...

6 Monate vor | 0

| akzeptiert

Beantwortet
A table of s versus t.
There are a couple of errors in your code. First, the way you define the array t. Second, for array operations, use the dot no...

6 Monate vor | 0

Beantwortet
A compact way to (i) sum two rows and two columns and then (ii) remove one of the two summed rows and one of the two summed columns
Your way is already quite compact. Maybe what you want to avoid is having to concatenate. Then, you could try this. x1 = [1 0 ...

6 Monate vor | 0

| akzeptiert

Beantwortet
How to form a matrix based on the order of input
Input= [110 101 011 111 100 001 010]; M = Input == sort(Input)'

6 Monate vor | 1

| akzeptiert

Beantwortet
function handle as array
That's because mtimes(a,b) = a*b, and if a is 4x4 and b is 4x1 than the operation yields a 4x1 array. I think what you might wa...

6 Monate vor | 0