Community Profile

photo

Fabio Freschi


Politecnico di Torino

Last seen: Today Active since 2014

Statistics

All
  • Knowledgeable Level 5
  • Pro
  • 12 Month Streak
  • Revival Level 2
  • First Review
  • 5-Star Galaxy Level 2
  • First Submission
  • Thankful Level 3
  • First Answer
  • Scavenger Finisher
  • Solver

View badges

Content Feed

View by

Answered
Minimal-code to get axes limits of log-log plots, but using gscatter
You can remove the negative part of the axis before setting the log scale set(gca,'XLim',[0 max(xlim)],'YLim',[0 max(ylim)]); ...

1 month ago | 0

Answered
How to plot Temperature vs Efficiency curve using For loop and Linspace?
I have commented your plots to avoid moltiple figures % numebr of temperatures nT = 100; % temperature vector T = linspace(2...

1 month ago | 1

| accepted

Question


Calculation of consistent initial conditions for ODE
(minor edit) Hi everyone, I have written wrapper functions calling MATLAB's ODE solvers. Specifically, my problems are DAEs wi...

1 month ago | 1 answer | 0

1

answer

Answered
How to find same unique in two different size arrays?
Use ismember % data x=[1 22 22 3 8 19]; y=[22 10 19 35]; % engine [iii,jjj] = ismember(y(:),x(:)); countCommon = su...

1 month ago | 0

| accepted

Answered
Having trouble using for loops to create a matrix
I reproduce the result of the picture, because the question is not clear. a = 25 ; b = 5 ; c = (2*a)/b - 1 ; % do not use mi...

1 month ago | 0

| accepted

Answered
How to plot a function
You may use fplot figure, hold on fplot(@(x)x.^-3,[1 1e5]) fplot(@(x)x.^-2.8,[1 1e5]) % use bi-logaritmic scale set(gca,'...

1 month ago | 0

Answered
Ax = 0 with 2 values of x known
The post is old but the question arises many times, so I post here my solution. It is a generalization of @Matt J solution. Sup...

2 months ago | 0

Answered
Looking for visualization method to present finite difference numerical solution in 2D
You may use the low-level patch function. Since I don't have your data, please find below a self-consistent example showing the ...

4 months ago | 0

Answered
smooth step function with rise time
My colleague Sofia have found a paper [1] where authors report the analytic approximation of the piece-wise linear step function...

8 months ago | 1

| accepted

Question


smooth step function with rise time
Hi everyone, I know this question is more related to math than Matlab, but I know there are many gurus out there who can easily...

9 months ago | 3 answers | 1

3

answers

Answered
How can I calculate the sum of the absolute error?
Please check the code below. clear all, close all % model F = @(c,x)c(1)+c(2)*x+c(3)*(x.^2-1); % data xk = [-2 -1 0 1 ...

10 months ago | 1

| accepted

Answered
Drawing a rotating circle on a sphere
The code should be self-explicative [X,Y,Z] = sphere; % figure figure, hold on axis equal, view([1 1 1]); % sphere wit...

10 months ago | 0

| accepted

Answered
Showing me wrong Matrix Size.
multiply without the 'dot' OO= N*kk;

10 months ago | 0

Answered
How can you solve a system of second order differential equation, which is not time, but length and radius dependent?
This is not an ODE but a PDE. you should have a look at pdepe

10 months ago | 2

| accepted

Answered
We have a column vector and a row vector both of same lengths. How to use sum function to get element wise sum of two vectors and final answer display in row vector
vect3 = vect1.'+vect2 If you want to be sure of the element by element sum, regardles the shape of the two vectors (row or colu...

10 months ago | 0

| accepted

Answered
How to randomly change element of matrix?
You can use linear indexing % your matrix A = rand(10,100); % create the folder mkdir('storage'); % loop for i = 1:100...

10 months ago | 2

Answered
How to create a series of circle by using a specific radius in cartesian?
Try something like this % anonymous function to plot a circle given the center coordinates and the % radius plotcircle = @(x,...

10 months ago | 0

| accepted

Answered
Converting Euler ODE to the MATLAB code
f is an anonymous function f = @(t,y)[-2*y(1)+y(2)+15*cos(t); 2*y(1)-y(2)]; note that your script is not correct, since t is t...

10 months ago | 1

| accepted

Answered
How to call a variable matrix from one script to another script
I am not sure I have understtod correctly your problem. I give it a try. I would add an extra layer using an anonymous function...

10 months ago | 1

| accepted

Answered
How to use ~= operator as constraint function?
You may have a look here or here

10 months ago | 0

Answered
How to compare two time signals with different amount of samples?
Use interp1 to resample your vector(s) in order to have the same length clear variables, close all % time vector t1 = 0:1/1...

10 months ago | 1

Answered
solve efficiently sparse large linear system of equations
I would let the backslash operator work on this matrix sol = L\f; Can you share the original matrix to make other attempts?

10 months ago | 0

Answered
how to use lsqnonlin to solve conditional equation
The following code should be self explainatory. In the opposite case, simply ask clear all, close all % some dummy params va...

10 months ago | 0

| accepted

Answered
how to ascribe two values to a parameter such that it will be time dependent
You can pass an extra parameter to RiceG1 function using an anonmymous function. In your driver function add % extra anonimous ...

10 months ago | 1

Answered
Can someone help me implement my Kuramoto Model with time delay please?
Your function requires additional parameters. One way to pass them is to use an anonymous function as extra layer % params N =...

10 months ago | 0

| accepted

Answered
Euler's method in matlab
Any ODE solver gives the unknown function(s) as result, not its derivative. So, yes, your results are x and y. Note that in you...

10 months ago | 0

| accepted

Answered
for loop/periodic implementation for number or arrays?
If you want to force the max and min values of your vectors, you can preprocess them x0(x0 < 1 & x0 > nx+1) = 1; If the bounda...

10 months ago | 1

| accepted

Answered
How to get this while cycle?
if B and C are matrices, make them vectors using : while any(abs(a_0-a) > 1e-6) || any(abs(B_0(:)-B(:)) > 1e-6) || any(abs(C_0(...

11 months ago | 1

| accepted

Answered
how to find out node coordinates for a simple quad element?
It depends on your data structure: now your qeustion is rather vague. Assuming that you have the node coordinates in the Nx3 ar...

11 months ago | 1

Answered
Hwo to normalize a Matrix ?
Following the formula of the OT the normalization has to be done according to the max and min of each row. Note that the matrix ...

11 months ago | 2

| accepted

Load more