Community Profile

photo

Fabio Freschi


Politecnico di Torino

126 total contributions since 2014

Contact

Fabio Freschi's Badges

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

View details...

Contributions in
View by

Answered
Is there a way of removing these for loops to speed up my code?
Profiling your code it comes up that the most demanding routine is the Green function calculation, with 0.374s: I have rewrit...

17 hours ago | 0

| accepted

Answered
Fit data to sawtooth shape
As usual, John is right. I tried to implement a strategy to fit sampled data with noise with a sawtooth waveform. I am pretty pr...

1 day ago | 0

Answered
Find position of a column given a specified array
idx = find(ismember([Mritsum(:) BrB(:)],point,'rows'))

1 day ago | 0

| accepted

Answered
How do i plot a 3D structure as in the attached picture?
I share with you a couple of function that I use to plot grounding grids. They are attached. Then you can use the following scri...

1 day ago | 0

| accepted

Answered
How to assign to an already 3d surface a colormap based on a set of values ?
Not sure if I have understood correctly. I try. I assume that you have the temperature plot as 2d matrix, as required by surf, b...

2 days ago | 1

| accepted

Answered
How can I plot this function
You may use surf % define a suitable number of x and y divisions. Here I used 200 x = linspace(0,10,200); y = linspace(1,30,2...

2 days ago | 0

| accepted

Answered
How can I extract a signal between zero up-crossings
You can take a look at this post, where zero crossing is discussed in details https://it.mathworks.com/matlabcentral/answers/26...

3 days ago | 0

| accepted

Answered
Unique ID Min and Max with multiple values per Unique ID
Tessa, look if this fits your problem % col vector M1 = [10 17 201 333 1000].'; M2 = [10 10 17 17 17 201 1000; 0.1 69 1.7 33...

3 days ago | 0

Answered
split dataset with probability weights
datasample has a two outputs, where the second is the index to the selected data in your npop1. So: [rw1,idSelected] = datasamp...

4 days ago | 0

| accepted

Answered
select certain matrix elements
You can simply concatenate your ranges using square brackets: A([1:10 20:30],1)

4 days ago | 0

| accepted

Answered
If statement with or condition
if any(settimana < bdr) ... else ... end

4 days ago | 0

| accepted

Answered
Setting min value of variables within a function
Maybe I don't understand correctly: if you want to set all negative entries of fval to 0 you can add fval(fval < 0) = 0; at th...

4 days ago | 0

| accepted

Answered
How do I make a 21x21 array from the center of a 200x150 array?
% dimensions n = 21; % rows m = 21; % cols % load image A = imread('grayscale.png'); % find center coordinate iCen...

4 days ago | 0

Answered
Create a matrix on the basis of other matrix
% your data SPI = [2 3 4 8 11 13 14 15 16 18 19 20]; AA = [1 2 3 4 0 11 14 15; 0 0 0 8 13 16 0 0; 0 0 0 0 ...

4 days ago | 0

| accepted

Answered
How to i produce a signal which is a combination of three sinusoidal signal oscillate a frequency?
% frequencies f = [10 100 200]; % random amplitudes V = rand(3,1); % random phase phi = 2*pi*rand(3,1); % time axis ...

4 days ago | 0

Answered
Create an array from others matrix
You can just append the matrices as they come. a=100; b=5; N=8; % inital empty matrix PM = []; % your loop for sec=1:a ...

4 days ago | 0

| accepted

Answered
Problem with while loop
% make matrices of the same length n1 = size(S1,1); n2 = size(S2,1); S1 = S1(min([n1,n2]),:); S2 = S2(min([n1,n2]),:); % ...

4 days ago | 0

Answered
Create a matrix on the basis of other matrix
Under the assumption that the "diversity" contains the same number of entries each row for i = 1:size(M,2) b(:,i) = unique...

4 days ago | 0

| accepted

Answered
problem with fzero in my code
your fun is neither acceppting nor using inputs You should write the symbolic function like this fun = @(x)cos(x); x0 = fzero...

5 days ago | 0

Answered
how can i slove this proplem "- The vector V is given by V=[2 8 7 3 1 0 8 9]. Write down a single instruction to produce a vector that contains 1 in the place of the odd numbers and -1 in the place of the even numbers."
A suggestion: you can easily find the reminder of the division by 2, so that even numers have reminder 0 and odd numbers reminde...

5 days ago | 0

| accepted

Answered
Operands to the || and && operators must be convertible to logical scalar values.
If you work with arrays, use the single & and not &&

5 days ago | 0

Answered
How to use fzero in a loop to obtain the first 3 positve solutions for cos3x=sin3x?
fzero gives you only one solution. In case of multiple roots, the choice depends on the initial choice and on the algorithm. If ...

5 days ago | 0

| accepted

Answered
how to write a code to extract a positive latitude value for the corresponding positive longitudinal cell value
% filter idx = longitudinal >= 50 & longitudinal <= 100 & latitude >= 0 & latitude <= 40; % selection longitudinal2 = longi...

5 days ago | 0

Answered
Making a vector out of all even and odd numbers using for, if
This happens because the original vector contains random numbers that change every time you run the code. So, also the number of...

5 days ago | 0

Answered
Error using plot Vectors must be the same length.
Some comments 1) Q is defined twice as symbolic variable, but it is actually an array 2) in the first loop N = 4, so length(t)...

6 days ago | 0

| accepted

Answered
Optimisation of function containing matrix
While waiting for the data, I try to solve one of the questions. you can set the missing constraint as x1-x2 = 0 x2-x3 = 0 .....

8 days ago | 0

| accepted

Answered
How to plot points on a line
I suggest you to check hold on, and the LineSpec of the command plot % your data new = rand(5,1); % open figure and retain ...

8 days ago | 1

| accepted

Answered
How to break an image into blocks?
Three assumprions 1) the image is a 2d matrix 2) the row/cols have 64x3, 3x64 and 3x3 blocks 3) you want 10 sub images, not 1...

8 days ago | 0

Answered
Optimization problem using external program
I can figure out two solutions 1) check if the simulation program has API for running it from "outside". In this case, make ref...

8 days ago | 0

| accepted

Answered
Intersections between 2 graphs
Try this software on fex https://it.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections

8 days ago | 0

| accepted

Load more