Answered

How to make and sum up a matrix with upper diagonal direction without for-loop condition [The fastest way!]

This is a fully vectorized operation. And it should be quite efficient. Requires making 2 matrices however. a = [1 2 0 0;3 ...

How to make and sum up a matrix with upper diagonal direction without for-loop condition [The fastest way!]

This is a fully vectorized operation. And it should be quite efficient. Requires making 2 matrices however. a = [1 2 0 0;3 ...

9 years ago | 1

| accepted

Answered

Export Bode Plot Data to Excel or text file

Given the data you can export a matrix or a cell array of data using xlswrite. If you have a matrix you can just use xlswri...

Export Bode Plot Data to Excel or text file

Given the data you can export a matrix or a cell array of data using xlswrite. If you have a matrix you can just use xlswri...

9 years ago | 0

Answered

how to convert HSV to RGB

The input for rgb2hsv is a rgb color vector |[r g b]| where intensities is between |0| and |1| the the other way it is vice vers...

how to convert HSV to RGB

The input for rgb2hsv is a rgb color vector |[r g b]| where intensities is between |0| and |1| the the other way it is vice vers...

9 years ago | 0

Answered

sir,i want to convert string into a hexadecimal value...is there any direct command?

Have you tried |unicode2native| ? decString = unicode2native('hi','utf-8'); hexString = dec2hex(decString); You can r...

sir,i want to convert string into a hexadecimal value...is there any direct command?

Have you tried |unicode2native| ? decString = unicode2native('hi','utf-8'); hexString = dec2hex(decString); You can r...

9 years ago | 0

| accepted

Question

Why are the 2 lines at the end so time consuming?

Hi, I just ran the profiler on a function and was quite surprised. EDIT: New run function outputVector = addAndReplace(i...

9 years ago | 3 answers | 0

Answered

How to change the figure default key shortcut?

Type preferences in the command window. Then under Keyboard -> Shortcuts you can change the key shortcut to New Figure.

How to change the figure default key shortcut?

Type preferences in the command window. Then under Keyboard -> Shortcuts you can change the key shortcut to New Figure.

9 years ago | 0

Question

How can I add color to predefined?

Hi, The plot function have a set of 7 colors that are predefined and can be added as plot(any_x,any_y,'r'); There are...

9 years ago | 2 answers | 1

Answered

Accessing/writing a fieldname values for a blind structure

You may want something like this, function printfields(theStruct) fields = fieldnames(theStruct); for k = 1:length(...

Accessing/writing a fieldname values for a blind structure

You may want something like this, function printfields(theStruct) fields = fieldnames(theStruct); for k = 1:length(...

9 years ago | 0

| accepted

Answered

Index exceed matrix dimensions.

You do not need make all these for loops for this. Instead of for a = 1:12; for f = 1:31 for b = 1:18; for ...

Index exceed matrix dimensions.

You do not need make all these for loops for this. Instead of for a = 1:12; for f = 1:31 for b = 1:18; for ...

9 years ago | 0

Answered

How to plot the results of conv?

Are you sure any of the curves are correct? It seems a bit strange that both curves peaks when one or both of the distributions ...

How to plot the results of conv?

Are you sure any of the curves are correct? It seems a bit strange that both curves peaks when one or both of the distributions ...

9 years ago | 0

| accepted

Answered

For some reason my code is not working , can you please help me. Thank you for your time| | *

Walter Roberson is correct in his answer. The syntax for sprintf is incorrect. However, you want to use a random integer, or at ...

For some reason my code is not working , can you please help me. Thank you for your time| | *

Walter Roberson is correct in his answer. The syntax for sprintf is incorrect. However, you want to use a random integer, or at ...

9 years ago | 0

Answered

How can I loop into a matrix?

I think that you need to loop here, since Matlab do normally not implement any operations that you reuqests. I mean [vector...

How can I loop into a matrix?

I think that you need to loop here, since Matlab do normally not implement any operations that you reuqests. I mean [vector...

9 years ago | 0

Answered

Multiple axis scales with contourf function

Ok try this, a = 1:5; b = 2:2:10; plot(a,b) ax1 = gca; ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation...

Multiple axis scales with contourf function

Ok try this, a = 1:5; b = 2:2:10; plot(a,b) ax1 = gca; ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation...

9 years ago | 0

| accepted

Answered

plot the integral of an array

Ok if it is not too important that the integral is completely correct I guess that "cumsum" would work. Otherwise, you may want ...

plot the integral of an array

Ok if it is not too important that the integral is completely correct I guess that "cumsum" would work. Otherwise, you may want ...

9 years ago | 0

Answered

Circular motion of a big dog

Does it work with r*[cos(0:14*pi)+1i*sin(0:14*pi)]; or do you need something else? Other coordinates or structure sho...

Circular motion of a big dog

Does it work with r*[cos(0:14*pi)+1i*sin(0:14*pi)]; or do you need something else? Other coordinates or structure sho...

9 years ago | 0

Question

Error using save can't write file

Hi, I have got this really strange error in matlab. When I try to run the command save(fullfile('filepath','filename'),'...

9 years ago | 1 answer | 0

Answered

multiplication of infinity by zero in Matlab Calculation

The solution to this problem comes from the mathematical limit. 1/0 = inf is really a bit sloppy. If you remember how this was i...

multiplication of infinity by zero in Matlab Calculation

The solution to this problem comes from the mathematical limit. 1/0 = inf is really a bit sloppy. If you remember how this was i...

9 years ago | 2

Answered

how to do double intergation

You can try if your version of MATLAB supports quad2d. This method uses adaptive simpsons quadrature to calculate 2D integrals. ...

how to do double intergation

You can try if your version of MATLAB supports quad2d. This method uses adaptive simpsons quadrature to calculate 2D integrals. ...

9 years ago | 0

| accepted

Answered

Error using inline/subsref (line 13) Not enough inputs to inline function.

In matlab the naturlal number e is not defined. It is still a variable. You can try by just typing e. Instead of using you just ...

Error using inline/subsref (line 13) Not enough inputs to inline function.

In matlab the naturlal number e is not defined. It is still a variable. You can try by just typing e. Instead of using you just ...

9 years ago | 2

| accepted

Answered

Remove high frequency noise

There is a function in matlab called "butter" that creates the coefficients to a butterworth filter of order N with cut-off freq...

Remove high frequency noise

There is a function in matlab called "butter" that creates the coefficients to a butterworth filter of order N with cut-off freq...

9 years ago | 0

| accepted

Question

Multiply a cell array with a scalar

Hi, I have a cell array that contain a number of different sized matrices. I need to multiply each of these cell elements, where...

9 years ago | 1 answer | 3

Answered

Why the preallocated matrix perform slower in the case below?

I am not 100% sure about this but I think that when performing the step ZZ = rand(nn(j)), matlab allocates more memory to store ...

Why the preallocated matrix perform slower in the case below?

I am not 100% sure about this but I think that when performing the step ZZ = rand(nn(j)), matlab allocates more memory to store ...

9 years ago | 0

Answered

Converting HEX to uint8

Try to reshape it first. You of course only want to send in 2hex at a time since the largest unit8 is 255. Try this, hexstri...

Converting HEX to uint8

Try to reshape it first. You of course only want to send in 2hex at a time since the largest unit8 is 255. Try this, hexstri...

9 years ago | 0

| accepted

Answered

Iteration across numerous columns

Ok I am still not sure what you meant but I think I have an idea. If you want the mean viscosity for each temperature, for every...

Iteration across numerous columns

Ok I am still not sure what you meant but I think I have an idea. If you want the mean viscosity for each temperature, for every...

9 years ago | 1

| accepted

Question

text image in matlab without using getframe

Hi, I would like to create a text image in matlab, so to say write a text and save it as an image. I have already managed to im...

9 years ago | 0 answers | 0

Answered

Question about exponential transfer function

What do you need this for? In general I would say that you cannot do this. Just look att the definition of the laplace transform...

Question about exponential transfer function

What do you need this for? In general I would say that you cannot do this. Just look att the definition of the laplace transform...

9 years ago | 0

Answered

Using the trigonometric Fourier series to develop MATLAB code to confirm correctness

The solution is quite direct, it is more a matter of understanding. You have the fourier series given as a function of t. What y...

Using the trigonometric Fourier series to develop MATLAB code to confirm correctness

The solution is quite direct, it is more a matter of understanding. You have the fourier series given as a function of t. What y...

9 years ago | 0

Question

how do I calculate laurent series in matlab?

Hi, I have a problem with calculating the laurent series expansion in matlab. The problem is that when I call the function se...

9 years ago | 1 answer | 0

Answered

problem in finding the mode for the following matrix

It works for me with the given atrix. Are you sure this is the exact values of JJ? Otherwise you need to truncate it to a tolera...

problem in finding the mode for the following matrix

It works for me with the given atrix. Are you sure this is the exact values of JJ? Otherwise you need to truncate it to a tolera...

9 years ago | 0

| accepted

Answered

finding common elements in a matrix

You may use the function ismember. The syntax is [member,ind] = ismember(A,B); The first output shows which elements in ...

finding common elements in a matrix

You may use the function ismember. The syntax is [member,ind] = ismember(A,B); The first output shows which elements in ...

9 years ago | 0