Answered

Changing a for loop to recursion

Recursion happens when a function calls itself, which is something you are not doing. The first step when creating a recursive...

Changing a for loop to recursion

Recursion happens when a function calls itself, which is something you are not doing. The first step when creating a recursive...

8 meses ago | 1

| accepted

Answered

matlab loops/if statements help for a beginner

So problem 1 is that size is outputting a vector and not a single value. It outputs both dimensions so for your example m is [1 ...

matlab loops/if statements help for a beginner

So problem 1 is that size is outputting a vector and not a single value. It outputs both dimensions so for your example m is [1 ...

8 meses ago | 0

| accepted

Answered

Trying to play Sound at random times during elapsed time.

So as you noticed, etime == randomTime will not work because etime needs input arguments. So fix that issue with this: etime(cl...

Trying to play Sound at random times during elapsed time.

So as you noticed, etime == randomTime will not work because etime needs input arguments. So fix that issue with this: etime(cl...

8 meses ago | 1

| accepted

Answered

Splitting a table into smaller ones based on two columns

I would do it as such: n = 1; a = your table% I used table([1;2;3;4;5;],[1;5;1;3;1]) to sort of test while ~isempty(a) % whi...

Splitting a table into smaller ones based on two columns

I would do it as such: n = 1; a = your table% I used table([1;2;3;4;5;],[1;5;1;3;1]) to sort of test while ~isempty(a) % whi...

8 meses ago | 1

Answered

How can I make a step response graph for open Loop Ziegler-Nichols Method?

When trying to do transfer functions in matlab one very nice way to do it is with s = tf('s'); Now, s indicates it is a trans...

How can I make a step response graph for open Loop Ziegler-Nichols Method?

When trying to do transfer functions in matlab one very nice way to do it is with s = tf('s'); Now, s indicates it is a trans...

8 meses ago | 1

Answered

Help with Padovan Sequence

You cannot start at P(0) because matlab does not let you index at 0. However, you can make it so that it works as expected. Ever...

Help with Padovan Sequence

You cannot start at P(0) because matlab does not let you index at 0. However, you can make it so that it works as expected. Ever...

8 meses ago | 2

| accepted

Answered

Convert row or coloumn matrix into rowXcoloumn matrix

I would do it as such: P = 1:10; out = reshape(P,[2,5]); out = out'; % Take transpose

Convert row or coloumn matrix into rowXcoloumn matrix

I would do it as such: P = 1:10; out = reshape(P,[2,5]); out = out'; % Take transpose

8 meses ago | 0

| accepted

Answered

Two dimensional interpolation polynomial

First off, I looked a little bit on wikis to find https://en.wikipedia.org/wiki/Multivariate_interpolation which might have what...

Two dimensional interpolation polynomial

First off, I looked a little bit on wikis to find https://en.wikipedia.org/wiki/Multivariate_interpolation which might have what...

8 meses ago | 1

| accepted

Answered

Plotting loop value according to years

The problem is that the value b is not being saved within the loop, so your plot function is trying to plot a single value which...

Plotting loop value according to years

The problem is that the value b is not being saved within the loop, so your plot function is trying to plot a single value which...

8 meses ago | 0

Answered

How to calculate averaged values from 5-min interval values

Using for loops is a very straightforward way that this can be done: x = yourData; %your data size1 = length(x)/12; size2 = 2...

How to calculate averaged values from 5-min interval values

Using for loops is a very straightforward way that this can be done: x = yourData; %your data size1 = length(x)/12; size2 = 2...

8 meses ago | 0

| accepted

Answered

Separating a colymn into two columns (.txt file)

I would do it like this: %t = your table; dataCell = table2cell(t); % convert to cells dataCell = dataCell(11:end); % remove ...

Separating a colymn into two columns (.txt file)

I would do it like this: %t = your table; dataCell = table2cell(t); % convert to cells dataCell = dataCell(11:end); % remove ...

8 meses ago | 0

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of elements.

The first problem is that Tr is a vector being assigned to a single value of r1, this is fixed as such: r1(n+1)=r1(n)+h*(K01*(C...

Unable to perform assignment because the left and right sides have a different number of elements.

The first problem is that Tr is a vector being assigned to a single value of r1, this is fixed as such: r1(n+1)=r1(n)+h*(K01*(C...

9 meses ago | 0

Answered

I need help with some graphs

Since you need to plot in 3 dimensions I will be using the surf function. What I would first do is solve all of these equation...

I need help with some graphs

Since you need to plot in 3 dimensions I will be using the surf function. What I would first do is solve all of these equation...

9 meses ago | 1

Answered

Simulink - How to create a conditional "if" block with more than 3 conditions?

**Moved from questions to answer** When you know the matlab code needed to do something in Simulink a Matlab Fuction Block can ...

Simulink - How to create a conditional "if" block with more than 3 conditions?

**Moved from questions to answer** When you know the matlab code needed to do something in Simulink a Matlab Fuction Block can ...

9 meses ago | 0

| accepted

Answered

How to skip a file in reading a series of csv files using csvread?

One method, though it may be one that is often advised against, is to use a try catch block around the code. When an error occur...

How to skip a file in reading a series of csv files using csvread?

One method, though it may be one that is often advised against, is to use a try catch block around the code. When an error occur...

9 meses ago | 0

| accepted

Answered

How to change the style or fount of a static text on GUIDE

Inside the guide interface you can double click the static text to bring up its properties. Then, you can change the listed font...

How to change the style or fount of a static text on GUIDE

Inside the guide interface you can double click the static text to bring up its properties. Then, you can change the listed font...

9 meses ago | 0

| accepted

Answered

Updating a value inside for loop

A common way people do things like this is with an if statement. For the condition of the if statement you need to relate it to ...

Updating a value inside for loop

A common way people do things like this is with an if statement. For the condition of the if statement you need to relate it to ...

9 meses ago | 1

| accepted

Answered

hi how to solve below eqation in matlab command window in tf command

The tf function expects the num and den to be matrices that hold the coefficients to the numerator and denominator. In your case...

hi how to solve below eqation in matlab command window in tf command

The tf function expects the num and den to be matrices that hold the coefficients to the numerator and denominator. In your case...

9 meses ago | 0

| accepted

Answered

plotting data from data files and saving each plot through out each run of the loop

If you wish to have all the plots on the same figure, you need to use figure; hold on %The rest of your code If you wish to...

plotting data from data files and saving each plot through out each run of the loop

If you wish to have all the plots on the same figure, you need to use figure; hold on %The rest of your code If you wish to...

9 meses ago | 0

| accepted

Answered

Element replacement of matrix.

If using a for loop is not actually a requirement you can do this very simply as such: myMatrix = rand(5,4); % create 5x4 matri...

Element replacement of matrix.

If using a for loop is not actually a requirement you can do this very simply as such: myMatrix = rand(5,4); % create 5x4 matri...

9 meses ago | 0

| accepted

Answered

How to edit plots?

Using your sample code, I do not see what the error is. However I made a few changes to the code that I believe make the output ...

How to edit plots?

Using your sample code, I do not see what the error is. However I made a few changes to the code that I believe make the output ...

9 meses ago | 0

Answered

How to randomize audio files

It looks to me that the line aud_file=strcat('C:\toolbox\aud_file\',audio_files(i).name); is where you get a song. Since the ...

How to randomize audio files

It looks to me that the line aud_file=strcat('C:\toolbox\aud_file\',audio_files(i).name); is where you get a song. Since the ...

9 meses ago | 1

| accepted

Answered

Trajectory animation using coordinate points

I would do it like this: % x1,x2,y1,y2,z1,z2 are your coordinate vectors tstep = .1; % the amount of time between each value i...

Trajectory animation using coordinate points

I would do it like this: % x1,x2,y1,y2,z1,z2 are your coordinate vectors tstep = .1; % the amount of time between each value i...

9 meses ago | 1

Answered

How would you plot a graph which a ball then rolls down (say a y=x^2 graph)

I attached a .m file I created that should work pretty well. It uses a numerical solution by calculating the slope at discrete t...

How would you plot a graph which a ball then rolls down (say a y=x^2 graph)

I attached a .m file I created that should work pretty well. It uses a numerical solution by calculating the slope at discrete t...

9 meses ago | 1

Answered

Sorting a table in Matlab

Yes, you can do it with the sortrows function. Here is an example: A = [1 2 4 5 3 6 5 6]; B = {'a', 'b', 'c', 'e', 'f', 'ba', ...

Sorting a table in Matlab

Yes, you can do it with the sortrows function. Here is an example: A = [1 2 4 5 3 6 5 6]; B = {'a', 'b', 'c', 'e', 'f', 'ba', ...

9 meses ago | 0

| accepted

Answered

So i wanted to add a column to this table.

So one big problem here is that you do not have a table. You have a matrix. And matrices cannot have strings and numbers in them...

So i wanted to add a column to this table.

So one big problem here is that you do not have a table. You have a matrix. And matrices cannot have strings and numbers in them...

10 meses ago | 1

Answered

hey guys im trying to plot this in 3D but i keep getting an error, "Data cannot have more than 2 dimensions."

So the issue is that plot3 takes either a vector or a 2d matrix. Since you are plotting it as points you do not actually need to...

hey guys im trying to plot this in 3D but i keep getting an error, "Data cannot have more than 2 dimensions."

So the issue is that plot3 takes either a vector or a 2d matrix. Since you are plotting it as points you do not actually need to...

10 meses ago | 2

| accepted

Answered

Index exceeds matrix dimensions

It appears that for some reason fileNameArray is not being populated with values in the line fileNameArray = dir('*.dat'); Ma...

Index exceeds matrix dimensions

It appears that for some reason fileNameArray is not being populated with values in the line fileNameArray = dir('*.dat'); Ma...

10 meses ago | 0

Answered

How to find specific values in a table, and create an array from rows containing those values?

Here is my go at it. % Create my table so you know what I am testing with. names = {'ssrp' , 'ssrp','tghh'}'; values = [123, ...

How to find specific values in a table, and create an array from rows containing those values?

Here is my go at it. % Create my table so you know what I am testing with. names = {'ssrp' , 'ssrp','tghh'}'; values = [123, ...

10 meses ago | 0

| accepted

Answered

Index exceeds array bounds error

The problem is a0. In the line hzrd(i,j)=exp(a(i)+b*w(i,j)) ; a needs to be have at least k elements for it to work. You set ...

Index exceeds array bounds error

The problem is a0. In the line hzrd(i,j)=exp(a(i)+b*w(i,j)) ; a needs to be have at least k elements for it to work. You set ...

10 meses ago | 1

| accepted