Answered

EPS export issue: blank figure

Hi, I usually export matlab figures in .svg format, then I modify them in inkscape and save it to .pdf. I add it in LaTex docum...

EPS export issue: blank figure

Hi, I usually export matlab figures in .svg format, then I modify them in inkscape and save it to .pdf. I add it in LaTex docum...

3 månader ago | 0

Answered

How to set specific variables in fmincon to be integers only?

Hi, another solution could be adding non linear equality constraints: for example remainder of division between first variable ...

How to set specific variables in fmincon to be integers only?

Hi, another solution could be adding non linear equality constraints: for example remainder of division between first variable ...

3 månader ago | 0

Answered

How to modify data vector

Hi, you convert to string your time vector (num2str function) and then convert it to date (datetime function), specifying input...

How to modify data vector

Hi, you convert to string your time vector (num2str function) and then convert it to date (datetime function), specifying input...

3 månader ago | 0

Answered

How to save each term from a sum

Hi, try to run this code. I add a plot in which I show how "pi1" converges toward to pi value. clear n = input('Number of ter...

How to save each term from a sum

Hi, try to run this code. I add a plot in which I show how "pi1" converges toward to pi value. clear n = input('Number of ter...

3 månader ago | 0

Answered

Print figure without its title

Hi, an easy and fast solution could be save first the figure and then add title, as following code: close all; clear all; cl...

Print figure without its title

Hi, an easy and fast solution could be save first the figure and then add title, as following code: close all; clear all; cl...

3 månader ago | 0

Answered

how to plot multiple graphs

Hi, you can plot all these figure by using a for loop cycle. Example: for ii = 1:180 figure plot(x,y) end In this...

how to plot multiple graphs

Hi, you can plot all these figure by using a for loop cycle. Example: for ii = 1:180 figure plot(x,y) end In this...

3 månader ago | 0

Answered

Protect the size of a preallocated matrix

Hi, in MATLAB numeric arrays are free to change size, i.e. if you add an element outside intial defined dimension, then array w...

Protect the size of a preallocated matrix

Hi, in MATLAB numeric arrays are free to change size, i.e. if you add an element outside intial defined dimension, then array w...

3 månader ago | 0

| accepted

Answered

Find rows of cell array containing certain specific multiple cells?

Hi, try to run following code, variable 'r' returns you row that contains what are you looking for: [r c] = find(strcmp(ca,'g'...

Find rows of cell array containing certain specific multiple cells?

Hi, try to run following code, variable 'r' returns you row that contains what are you looking for: [r c] = find(strcmp(ca,'g'...

3 månader ago | 0

| accepted

Answered

I want to double numbers that are less than the given parameter. What do I need to change

Your function will be: function dataSamples = AdjustMinValue(numberSamples, userSamples, minValue) % numberSamples: Number of ...

I want to double numbers that are less than the given parameter. What do I need to change

Your function will be: function dataSamples = AdjustMinValue(numberSamples, userSamples, minValue) % numberSamples: Number of ...

3 månader ago | 0

Answered

Reading all text from specific cell from .csv file.

Hi, try to run following code, you should obtain what you have asked: close all clear all clc filename = 'dtc_table.csv';...

Reading all text from specific cell from .csv file.

Hi, try to run following code, you should obtain what you have asked: close all clear all clc filename = 'dtc_table.csv';...

3 månader ago | 0

| accepted

Answered

How merge block works in simulink?

For merge block see reference: https://www.mathworks.com/help/simulink/slref/merge.html However, if you try to model as merge_b...

How merge block works in simulink?

For merge block see reference: https://www.mathworks.com/help/simulink/slref/merge.html However, if you try to model as merge_b...

3 månader ago | 1

Answered

Why is my scatter plot producing inconsistent results?

Hi, your code is correct. ev17 and sch17 have the same value (2631). Both are plotted with diamond marker, thus they are superi...

Why is my scatter plot producing inconsistent results?

Hi, your code is correct. ev17 and sch17 have the same value (2631). Both are plotted with diamond marker, thus they are superi...

3 månader ago | 1

Answered

Schröder number with formula

I show you how you could solve your problem. Try this code: prompt = 'n: '; n = input(prompt); % ask the user for a...

Schröder number with formula

I show you how you could solve your problem. Try this code: prompt = 'n: '; n = input(prompt); % ask the user for a...

3 månader ago | 0

Answered

write indexes in a plot

Hi, look this answer: https://www.mathworks.com/matlabcentral/answers/97277-how-can-i-apply-data-labels-to-each-point-in-a-scat...

write indexes in a plot

Hi, look this answer: https://www.mathworks.com/matlabcentral/answers/97277-how-can-i-apply-data-labels-to-each-point-in-a-scat...

3 månader ago | 0

| accepted

Answered

Random specified numbers.

Hi, you can use randsample matlab function. (Reference: https://www.mathworks.com/help/stats/randsample.html). y = randsample...

Random specified numbers.

Hi, you can use randsample matlab function. (Reference: https://www.mathworks.com/help/stats/randsample.html). y = randsample...

3 månader ago | 0

Answered

Random variation in a signal in Simulink

Hi, if you can use stateflow in your simulink model, following chart could be a solution: As you can see you start from stat...

Random variation in a signal in Simulink

Hi, if you can use stateflow in your simulink model, following chart could be a solution: As you can see you start from stat...

3 månader ago | 0

| accepted

Answered

How to make real and imaginary plot of the graph same color

Hi, a fast and easy solution could be generate a triplette of RGB values randomly at each iteration and you use it as color fo...

How to make real and imaginary plot of the graph same color

Hi, a fast and easy solution could be generate a triplette of RGB values randomly at each iteration and you use it as color fo...

3 månader ago | 1

| accepted

Answered

How to simulate a random castle in a chessboard?

Hi, if you try to run this code: close all clear all clc n = 8; %chessboard size CB = zeros(n,n); %init ...

How to simulate a random castle in a chessboard?

Hi, if you try to run this code: close all clear all clc n = 8; %chessboard size CB = zeros(n,n); %init ...

3 månader ago | 0

| accepted

Answered

How to plot fixed value for a number of ranges splited by a fixed step size in MATLAB?

Hi, you can obtain your plot by using 'bar' matlab function (reference: https://www.mathworks.com/help/matlab/ref/bar.html). F...

How to plot fixed value for a number of ranges splited by a fixed step size in MATLAB?

Hi, you can obtain your plot by using 'bar' matlab function (reference: https://www.mathworks.com/help/matlab/ref/bar.html). F...

3 månader ago | 0

| accepted

Answered

Exact value in excel sheet of function

Hi, you can see on command window by enter following lines: format long y(783) In this way you can see on command wi...

Exact value in excel sheet of function

Hi, you can see on command window by enter following lines: format long y(783) In this way you can see on command wi...

3 månader ago | 1

| accepted

Answered

How to fix axes in dynamic plot

Hi, you can add in your code xlim and ylim functions close all x=@(t)(sin(4*t)).^2; y=@(t)cos(5*t); z=pi; figure(1) for...

How to fix axes in dynamic plot

Hi, you can add in your code xlim and ylim functions close all x=@(t)(sin(4*t)).^2; y=@(t)cos(5*t); z=pi; figure(1) for...

3 månader ago | 0

Answered

Specifying row and columns in writetable function

Hi, see https://www.mathworks.com/help/matlab/ref/writetable.html on how to use writetable function. writetable(T,'myData.xls'...

Specifying row and columns in writetable function

Hi, see https://www.mathworks.com/help/matlab/ref/writetable.html on how to use writetable function. writetable(T,'myData.xls'...

3 månader ago | 1

Answered

Plot grided latitude and longitude as pixels on map

I obtain this result: by running the following code: load lati.mat load loni.mat [LONG, LAT] = meshgrid(loni,lati); Z =...

Plot grided latitude and longitude as pixels on map

I obtain this result: by running the following code: load lati.mat load loni.mat [LONG, LAT] = meshgrid(loni,lati); Z =...

3 månader ago | 3

| accepted

Answered

Am I doing this right? (a Math formula to Matlab language)

Hi, A and B terms are wrong. What you wrote is the square of sum of differences. Instead formula is the sum of square of diffe...

Am I doing this right? (a Math formula to Matlab language)

Hi, A and B terms are wrong. What you wrote is the square of sum of differences. Instead formula is the sum of square of diffe...

3 månader ago | 1

Solved

Remove the vowels

Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

3 månader ago

Solved

Counting Money

Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99. E...

3 månader ago

Solved

Pangrams!

A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

3 månader ago

Solved

Remove any row in which a NaN appears

Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

3 månader ago

Solved

Return the 3n+1 sequence for n

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

3 månader ago

Solved

Swap the first and last columns

Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

3 månader ago