Answered
stepplot systems name
For one system: sys = rss(3); h = stepplot(sys1); h.Response.Name = 'Bill'; Or multiple systems: sys1 = rss(3...

15 years ago | 2

| accepted

Answered
file name manipulation
NUM2STR is useful for stuff like this. Y = {'a' 'b' 'c' 'd'} for jj = 1:4 for n = 1:9 filename = ['S_1...

15 years ago | 0

Answered
Diagonal direction - difference between adjacent elements
Use 2-D convolution: I = [ 5 4 3; 9 8 6; 6 3 4;] I_1 = I; I_2 = I; I_1(2:en...

15 years ago | 3

| accepted

Answered
HELPPP!!! polynomial to transfer function?
Here's an idea. syms x eq1 = x^2+2*x+1 eq2 = x^2+3*x+2 s = tf('s') eq1_s = strrep(char(eq1),'x','s'); ...

15 years ago | 0

| accepted

Answered
Access to for loop index
There is no special variable. You have to do it yourself: i_list = [start:step:end] for n = 1:numel(i) i = i_list(n)...

15 years ago | 1

Answered
Uncertainty of mldivide
Any uncertainty introduced by using MLDIVIDE is *many many many* orders of magnitude smaller than errors due to having a real-wo...

15 years ago | 3

Answered
Rearranging matrices
If your original matrix is called "data" data_new = zeros(6,168); for n = 0:(168/6)-1 data_new(:,6*n + (1:6)) = data...

15 years ago | 1

Answered
TeX problem -- why?
MATLAB's TeX does not support those. However, these two will work: gtext('$\frac{1}{2}$','interpreter','latex','fontsize',...

15 years ago | 0

| accepted

Answered
assign differernt marker and put an offset in x-axis in subplot()
You have 15 different patterns, and since there are only 13 possible markers, why not divide them up using (5 markers) x (3 colo...

15 years ago | 1

| accepted

Answered
need to extract rgb value of image in the format [r g b]
If you have a RGB image that is [m x n x 3], you can use the RESHAPE command to give you the columns as [r g b]: I = imread...

15 years ago | 0

Answered
Incorrect equilibrium values using fsolve
If you're going to do it by hand, then at least let MATLAB help you check your answers (using symbolic variables): %flow ra...

15 years ago | 0

| accepted

Answered
While Loop problems
This is one way to go about doing it. (x is from left to right, and y is from top to bottom.) dirt_grid =[ 0 1 1 ...

15 years ago | 0

| accepted

Answered
Flag for ODE15s solver
There are probably a number of ways to do this, but here is one of them. You can see I am calling ode15s, but I am putting limit...

15 years ago | 0

Answered
sorting vectors
Call sort with a second output argument. x=[25,69,45,53]; y=[160,201,199,450]; [xsorted, I] = sort(x) ysorted = y(I)...

15 years ago | 1

Answered
Changes to QR factorization: qr()
Absolutely agree with Mike here. If Z weren't already unitary, why would those 2 Options give you the same result in general? M...

15 years ago | 1

Answered
Use elseif inside a case switch. What is Wrong with my code? Only the first "if" case only works none of the elseif work?? Please any advice would help.
x = 0.1; if 0 < x < 0.2 disp('hello') end This sort of "IF" test does not work in MATLAB. What happens is ...

15 years ago | 0

| accepted

Answered
How to optimize the Parameters in my code
Your answer is actually close, but maybe it wasn't entirely straightforward to match it to the other example without some more e...

15 years ago | 0

Answered
3-D histogram in spherical coordinates
Just for fun, and because it makes for a great example of visualizing spherical data, here is a script to display a spherical...

15 years ago | 3

| accepted

Answered
I would like to plot some data like an oscilloscope, going from the right to the left part of the screen.
You first create a graphics object, then update it's properties little by little, for example like this: y = randn(1,1000);...

15 years ago | 2

Answered
How to optimize the Parameters in my code
People often ask how to do this. Basically you need to pass your ODE solver to your optimization solver. This is an example of h...

15 years ago | 0

| accepted

Answered
How to select/highlight a cell in the uitable automatically? Thank you.
For what you are trying to do, a listbox would be a more natural choice. Here 'Max = 1' is saying that you can only select on...

15 years ago | 1

Answered
Problem with integrals
A very good question. You need to use QUADV here instead of QUAD. quadv(@(x) exp(x.^2).*quad(@(z) exp(z.^2),-2,x),-2,2) ...

15 years ago | 0

| accepted

Answered
Surface Texturing
This is not as difficult as you think. You can use the following code as a starting point. Once you understand why it works, the...

15 years ago | 0

Answered
How to automatic detect selections in different uitables, and clear the selections in some of the uitables? Thanks
If you want to clear all the selections, you can redraw the table (h is the uitable handle): tmp = get(h,'data'); set(h,...

15 years ago | 0

| accepted

Answered
selecting the closest possible date
If your matrix is M, and you have the Statistics Toolbox, then: X = 728628; grpstats(M(:,2),M(:,1),@(z)min(z(z > X))) ...

15 years ago | 0

Answered
covariance between 2 ts over time
The COV function does return a matrix. But this is not a problem since you can just extract out the relevant pieces. I think ...

15 years ago | 1

Answered
Interpolate
Here's one possible way to do it. I've handled the 5 consecutive zeros thing by using IMCLOSE, a function from the Image Process...

15 years ago | 0

Answered
plot() colors using colormap?
Maybe you could use patch objects to create the lines. colordef(figure,'black'); hold all startPoint_x = randn(1,...

15 years ago | 1

Answered
s-plane to z-plane transformation
Have you tried c2d? clear all close all %%Define G-filter in s-plane according to ISO 7196:1995E %poles p=[ -0....

15 years ago | 0

| accepted

Answered
Find intersection between line and circle
You're pretty close. Except you don't want to solve 'x^2 + y^2 = 0' You want to solve 'x^2 + y^2 = R^2' --------------...

15 years ago | 2

| accepted

Load more