Answered

How to write matlab code that result odd component zero?

%vector of random integers v1=randi(10,10,1); %find odd number and replace by zero v2=v1; v2(mod(v2,2)~=0)=0; [v1,v2]

How to write matlab code that result odd component zero?

%vector of random integers v1=randi(10,10,1); %find odd number and replace by zero v2=v1; v2(mod(v2,2)~=0)=0; [v1,v2]

2 months ago | 0

Answered

Index exceeds the number of array elements (1).

can't run your code because it need to open file. But check the sizes x1_rec, y1_rec, x2_rec, and y2_rec. it seems that you ...

Index exceeds the number of array elements (1).

can't run your code because it need to open file. But check the sizes x1_rec, y1_rec, x2_rec, and y2_rec. it seems that you ...

2 months ago | 0

Answered

Fill a vector with two vectors

v1 = [3 8 6 7]; v2 = [1 5 9 4]; r=[]; for i=2:1:length(v1) r=[r v1(i) v2(i)]; end r

Fill a vector with two vectors

v1 = [3 8 6 7]; v2 = [1 5 9 4]; r=[]; for i=2:1:length(v1) r=[r v1(i) v2(i)]; end r

2 months ago | 0

Answered

Reading Multiple sheets to different data sets

this may help https://www.mathworks.com/matlabcentral/answers/300842-importing-data-from-excel-across-multiple-sheets-and-file...

Reading Multiple sheets to different data sets

this may help https://www.mathworks.com/matlabcentral/answers/300842-importing-data-from-excel-across-multiple-sheets-and-file...

2 months ago | 0

Answered

Thickness of height profile in Matlab

Try this % to plot vertical line xAxis=1.25 ymin=B % min point ymax=A %max point line([xAxis xAxis], [ymin ymax]); % ad...

Thickness of height profile in Matlab

Try this % to plot vertical line xAxis=1.25 ymin=B % min point ymax=A %max point line([xAxis xAxis], [ymin ymax]); % ad...

2 months ago | 0

| accepted

Answered

A bouncing circle on a 2d plot, how to plot a cos2 function

In your code you have b= r+hmax/2*(cosd(t).^2)+hmax/2; which I think is the trajectory of the ball. and if you plot it you ge...

A bouncing circle on a 2d plot, how to plot a cos2 function

In your code you have b= r+hmax/2*(cosd(t).^2)+hmax/2; which I think is the trajectory of the ball. and if you plot it you ge...

2 months ago | 0

Answered

how to fprintf and disp on the same line

disp always starts new line afterward. you should only use fprintf and '\n' if you want to end the line fprintf('The number ...

how to fprintf and disp on the same line

disp always starts new line afterward. you should only use fprintf and '\n' if you want to end the line fprintf('The number ...

2 months ago | 0

| accepted

Answered

How do I fix this error to output the correct data? I get an error when I use disp.

if the error in "disp", use fprintf(formatSpec,A1,...,An) or maybe this works X=['You caught ' , wholeFishWeight , ' kg of f...

How do I fix this error to output the correct data? I get an error when I use disp.

if the error in "disp", use fprintf(formatSpec,A1,...,An) or maybe this works X=['You caught ' , wholeFishWeight , ' kg of f...

2 months ago | 0

Answered

How to enter intermittent entries in a vector

a=1:1:6; v=[]; for i=1:2:length(a) v=[v a(i) a(i+1) 0 0] ; end v

How to enter intermittent entries in a vector

a=1:1:6; v=[]; for i=1:2:length(a) v=[v a(i) a(i+1) 0 0] ; end v

2 months ago | 0

| accepted

Answered

Vector access and manipulation

do you only discard the function output for a vector of all zeros? or for zero elements. why not use if-else f =@(x) x.^2; Ve...

Vector access and manipulation

do you only discard the function output for a vector of all zeros? or for zero elements. why not use if-else f =@(x) x.^2; Ve...

2 months ago | 0

Answered

Why I get ans = logical 1

in your last case you use else then put a condition. you should either use "elseif" or no condition.

Why I get ans = logical 1

in your last case you use else then put a condition. you should either use "elseif" or no condition.

2 months ago | 1

| accepted

Answered

How to display graphically

not sure this is what you had in mind ... %Environment envSize=4; figure; x=-envSize:0.1:envSize; y=.5*sin(x); plot(y,x,'...

How to display graphically

not sure this is what you had in mind ... %Environment envSize=4; figure; x=-envSize:0.1:envSize; y=.5*sin(x); plot(y,x,'...

2 months ago | 1

| accepted

Answered

why reading .xls file using xlsread returns empty variables?

The problem is the data is not in the first sheet of the .xls file. I needed to sort the xls sheets before using [ndata, text...

why reading .xls file using xlsread returns empty variables?

The problem is the data is not in the first sheet of the .xls file. I needed to sort the xls sheets before using [ndata, text...

2 months ago | 0

| accepted

Answered

How can I modify negative values from two datasets based on a positive given one?

maybe this works ? if i == 1 y=y+(x-y); Coeff(i) = abs(max(y)/max(x)); else Coeff(i) = abs(max(...

How can I modify negative values from two datasets based on a positive given one?

maybe this works ? if i == 1 y=y+(x-y); Coeff(i) = abs(max(y)/max(x)); else Coeff(i) = abs(max(...

2 months ago | 0

Question

why reading .xls file using xlsread returns empty variables?

Hello I have some data in a .xls file. the file content is four colunms. the first row is a header then all others are numbers....

2 months ago | 1 answer | 0

Answered

How do i read audio and include it in my function?

check out this function [y,Fs] = audioread(filename) it reads data from the file named filename, and returns sampled data, y,...

How do i read audio and include it in my function?

check out this function [y,Fs] = audioread(filename) it reads data from the file named filename, and returns sampled data, y,...

2 months ago | 0

Answered

How do I add a text string after my contour labels?

If I understood your problem correctly... I think the answer in this question will help you https://www.mathworks.com/matlabcen...

How do I add a text string after my contour labels?

If I understood your problem correctly... I think the answer in this question will help you https://www.mathworks.com/matlabcen...

2 months ago | 0

Answered

compare and sort element in two arrays in matlab?

Try this code... I hope I understood the problem correctly clc; clear all; %function c = @(x) x.^2; %data a=[3 1 2];...

compare and sort element in two arrays in matlab?

Try this code... I hope I understood the problem correctly clc; clear all; %function c = @(x) x.^2; %data a=[3 1 2];...

2 months ago | 0

Answered

How can I get a smoothing line like Excel?

I tried the answer to this question https://www.mathworks.com/matlabcentral/answers/411231-connecting-data-points-in-a-smooth-...

How can I get a smoothing line like Excel?

I tried the answer to this question https://www.mathworks.com/matlabcentral/answers/411231-connecting-data-points-in-a-smooth-...

2 months ago | 0

| accepted

Answered

How do I create a multiline plot using values from a table?

If I understand the problem correctly this might help % creating tabel exampel col1 = {'A';'B';'C';'D';'E'}; col2 = [1:1:5]...

How do I create a multiline plot using values from a table?

If I understand the problem correctly this might help % creating tabel exampel col1 = {'A';'B';'C';'D';'E'}; col2 = [1:1:5]...

2 months ago | 0

Question

problem in converting a matrix of integers to vector of integers using str2num and num2str

Hello, I have a matrix x of this form (these are example values) 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 ...

2 months ago | 1 answer | 0

Question

How can I read csv file data correctly? I tried multiple ways

Hi I have a csv file and I am trying to import it to matlab. an example for the file content is the following (this is one row...

3 months ago | 2 answers | 0

Question

changing the activation function to ReLU? nntool command.

Hi ! I want to build a neural network such that it consist of 3 layers ( 2 ReLU layers and an output layer) with 10 neurons i...

9 months ago | 0 answers | 0

Question

Question about estimating an LTI system matrices using system identification toolbox.

Hi ! I would like to ask about the the system idintification toolbox. In my problem I used linear parameter varying model...

9 months ago | 0 answers | 0

Answered

how to find value of x for a known value of y(x), using fplot?

The only way I was able to do this is to change z(x). insted of having all the lines in one plot. I created a loop such that a...

how to find value of x for a known value of y(x), using fplot?

The only way I was able to do this is to change z(x). insted of having all the lines in one plot. I created a loop such that a...

10 months ago | 0

| accepted

Question

How to scatter/plot a vector vs a cell array ?

Hello, I have a vector w such that w=0:0.1:5 I use this vector to get values saved in a cell array. such that for each el...

10 months ago | 1 answer | 0

Question

how to find value of x for a known value of y(x), using fplot?

Hi ! I am using the function fplot to plot 5 functions. and the plot is working good. now for each function I am trying to...

10 months ago | 1 answer | 0

Question

How to keep the slider position the same after retrieving its value?

Hi ! I am using a slider and a pushbutton to get the value from the slider. but each time the push button is pressed the pos...

11 months ago | 1 answer | 0

Question

How to run functions in GUI opening function and pass variables?

Hi ! I would like to do the following (not sure if it is possible) : I would like to create a GUI and in the GUI_OpeningFc...

11 months ago | 0 answers | 0

Question

How to run matlab script within GUI file then wait for the GUI input in the script ?

Hi ! I have created a matlab script ("main.m") which with a loop. In each iteration I call a matlab GUI slider to get an in...

12 months ago | 0 answers | 0