Solved

First N Perfect Squares

*Description* Return the first N perfect squares *Example* input = 4; output = [ 1 4 9 16 ];

8 years ago

Solved

Check if number exists in vector

Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

8 years ago

Solved

Sorting

Assume that x is an n-by-2 matrix. The aim is to return the first column of x, but sorted according to the second column. Exa...

8 years ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

8 years ago

Answered

I have a matrix which is [y1 x1 y2 x2 y3 x3.......]. The size variable depends on the input, I wanna extract y(i) and x(i) seperately from this matrix.

a=1:10 y=a(1:2:end)' x=a(2:2:end)'

I have a matrix which is [y1 x1 y2 x2 y3 x3.......]. The size variable depends on the input, I wanna extract y(i) and x(i) seperately from this matrix.

a=1:10 y=a(1:2:end)' x=a(2:2:end)'

8 years ago | 0

| accepted

Answered

Maclaurin Series function in matlab

function Maclaurin n=5; x=input('enter the x value: '); epsilon_s=(0.5*10^(2-n)); epsilon=100; maclaurin(1)=1; ...

Maclaurin Series function in matlab

function Maclaurin n=5; x=input('enter the x value: '); epsilon_s=(0.5*10^(2-n)); epsilon=100; maclaurin(1)=1; ...

8 years ago | 0

Answered

Elementwise multiplication, function definition

[x, y] = meshgrid(linspace(0,400,400),linspace(0,30000,400)); A1 = -8.269000000000000; m1 = 2.071000000000000; m2...

Elementwise multiplication, function definition

[x, y] = meshgrid(linspace(0,400,400),linspace(0,30000,400)); A1 = -8.269000000000000; m1 = 2.071000000000000; m2...

8 years ago | 0

| accepted

Answered

Failed to add uniform noise to the image

Hi. You don't need imnoise: round(128+0.2)=128 with 0.1 and 0.2 like you didn't add any noise. Uniform noise with zero m...

Failed to add uniform noise to the image

Hi. You don't need imnoise: round(128+0.2)=128 with 0.1 and 0.2 like you didn't add any noise. Uniform noise with zero m...

8 years ago | 0

| accepted

Answered

could you fix these codes?

Hi. Use cell array: I=imread('moon.tif'); C=mat2cell(I(1:32,1:32),8*ones(1,4),8*ones(1,4)); imshow(C{5},'InitialMagni...

could you fix these codes?

Hi. Use cell array: I=imread('moon.tif'); C=mat2cell(I(1:32,1:32),8*ones(1,4),8*ones(1,4)); imshow(C{5},'InitialMagni...

8 years ago | 0

Answered

problem with ssim function

Hi. It's default window: window = fspecial('gaussian', 11, 1.5); If input images has smaller size than 11*11 (it's windo...

problem with ssim function

Hi. It's default window: window = fspecial('gaussian', 11, 1.5); If input images has smaller size than 11*11 (it's windo...

8 years ago | 0

| accepted

Answered

Create an anonymous function after Symbolic differentiation

Hi. syms x f=@(x) x^3+3*x+1; g=diff(f(x)) h=@(y) subs(g,y)

Create an anonymous function after Symbolic differentiation

Hi. syms x f=@(x) x^3+3*x+1; g=diff(f(x)) h=@(y) subs(g,y)

8 years ago | 0

Answered

Troubles with modeling step response in Simulink

Delete your Integrator block, you didn't define it in your code.

Troubles with modeling step response in Simulink

Delete your Integrator block, you didn't define it in your code.

8 years ago | 0

| accepted

Answered

From four different numbers, how can I find out the minimum and maximum numbers that can created from the digits?

Hi. A=7465; A=num2str(A)'; Minimum=str2num(sort(A)') maximum=str2num(sort(A,'descend')')

From four different numbers, how can I find out the minimum and maximum numbers that can created from the digits?

Hi. A=7465; A=num2str(A)'; Minimum=str2num(sort(A)') maximum=str2num(sort(A,'descend')')

8 years ago | 1

| accepted

Answered

Write a function getatriangle(R,f,b) that takes the number of rows R and returns a character matrix that has the shape of a triangle filled with the character 'f' on a background filled with the character 'b'.

Hi. R = 20; f = '@'; b = '-'; max_num=2*R-1; fprintf('\n'); for i=1:R S1=repmat(b,[1 R-i]); ...

Write a function getatriangle(R,f,b) that takes the number of rows R and returns a character matrix that has the shape of a triangle filled with the character 'f' on a background filled with the character 'b'.

Hi. R = 20; f = '@'; b = '-'; max_num=2*R-1; fprintf('\n'); for i=1:R S1=repmat(b,[1 R-i]); ...

8 years ago | 0

Answered

Subscript indices must either be real positive integers or logicals.

Hi. Use another name for your variable 'sin'. When you use it as a variable,then you can't use it as sinusoid function: fs ...

Subscript indices must either be real positive integers or logicals.

Hi. Use another name for your variable 'sin'. When you use it as a variable,then you can't use it as sinusoid function: fs ...

8 years ago | 0

Answered

built-in 2D convolution vs for-loop convolution differences?

Hi. You need to rotate your kernel 180 degree: x = 0:.1:pi; A = rand(100,100); M = sin(x).^2'*sin(x).^2; figure(1...

built-in 2D convolution vs for-loop convolution differences?

Hi. You need to rotate your kernel 180 degree: x = 0:.1:pi; A = rand(100,100); M = sin(x).^2'*sin(x).^2; figure(1...

8 years ago | 1

| accepted

Answered

How to output specific matrix component to excel?

Hi. Convert it to two dimensional, then use xlswrite: a=rand(3,3,4000); a1=a(1,1,1:500); a2=a1(:); xlswrite('Matla...

How to output specific matrix component to excel?

Hi. Convert it to two dimensional, then use xlswrite: a=rand(3,3,4000); a1=a(1,1,1:500); a2=a1(:); xlswrite('Matla...

8 years ago | 0

Answered

symbolic differentiation with multiple variables/parameters

See: doc matlabFunction Help: When converting symbolic expressions, the order is alphabetical.When converting symbolic ...

symbolic differentiation with multiple variables/parameters

See: doc matlabFunction Help: When converting symbolic expressions, the order is alphabetical.When converting symbolic ...

8 years ago | 0

Answered

Sum an array in one dimension to calculate the probability

Hi. A(:,:,1) =[0.4528 0.0477 0.0715;0.0220 0.0023 0.0035;0.0045 0.0005 0.0007;0.0511 0.0054 0.0081]; A(:,:,2) =[0.0129 0...

Sum an array in one dimension to calculate the probability

Hi. A(:,:,1) =[0.4528 0.0477 0.0715;0.0220 0.0023 0.0035;0.0045 0.0005 0.0007;0.0511 0.0054 0.0081]; A(:,:,2) =[0.0129 0...

8 years ago | 0

| accepted

Answered

How to assign a column vector a name in a matrix while processing multiple files (loop)?

Hi. What is the variable name that you want to calculate its 4th column average? if the name of the variable is the same in all ...

How to assign a column vector a name in a matrix while processing multiple files (loop)?

Hi. What is the variable name that you want to calculate its 4th column average? if the name of the variable is the same in all ...

8 years ago | 0

Answered

What is going wrong with my mesh command?

Hi. clear [x,y]=meshgrid(-10:0.1:10) d=max(sqrt(x.^2+y.^2),sqrt((x-5).^2+(y+1).^2)); d=max(d,sqrt((x-4).^2+(y-...

What is going wrong with my mesh command?

Hi. clear [x,y]=meshgrid(-10:0.1:10) d=max(sqrt(x.^2+y.^2),sqrt((x-5).^2+(y+1).^2)); d=max(d,sqrt((x-4).^2+(y-...

8 years ago | 0

| accepted

Answered

How to run this MATLAB codes in R-Programming?

Hi. function y=calcul(n,t) for j=1:t for i=1:100 [yy,i1]=fungi(n,j); point(i)=yy(j+1);...

How to run this MATLAB codes in R-Programming?

Hi. function y=calcul(n,t) for j=1:t for i=1:100 [yy,i1]=fungi(n,j); point(i)=yy(j+1);...

8 years ago | 0

Answered

how can i color the particular block of the image?

Hi. clear grayImage=imread('cameraman.tif'); blockNumber = 34; blockSizeC=32; blockSizeR=32; blockrows =8; b...

how can i color the particular block of the image?

Hi. clear grayImage=imread('cameraman.tif'); blockNumber = 34; blockSizeC=32; blockSizeR=32; blockrows =8; b...

8 years ago | 0

| accepted

Answered

how to find the length of characters stored in cell array?when each column contains words of different length?

Hi. a={'issue', 'information', 'books','subject'} L=cellfun(@length,a)

how to find the length of characters stored in cell array?when each column contains words of different length?

Hi. a={'issue', 'information', 'books','subject'} L=cellfun(@length,a)

8 years ago | 0

| accepted

Answered

Attempted to access x(2); index out of bounds because numel(x)=1. But I'm using a matrix?

Hi. You change your x in first loop : x = x(i) ====> x=22.5 after this x became a number.

Attempted to access x(2); index out of bounds because numel(x)=1. But I'm using a matrix?

Hi. You change your x in first loop : x = x(i) ====> x=22.5 after this x became a number.

8 years ago | 1

Answered

How to draw this figure?

Hi. m=0.5; [x,y]=meshgrid(-11:.1:11); d=sqrt(x.^2+y.^2); S=d; S(d>10)=0; S(d<=10&d>5)=exp(-0.5.*(d(d<=10&d>5...

How to draw this figure?

Hi. m=0.5; [x,y]=meshgrid(-11:.1:11); d=sqrt(x.^2+y.^2); S=d; S(d>10)=0; S(d<=10&d>5)=exp(-0.5.*(d(d<=10&d>5...

8 years ago | 0

| accepted

Answered

Error using imread (line 368) ; File "..." does not exist

Hi. change your current folder to myFolder: cd(myFolder) or use this: im1 = imread([myFolder pngfiles(1).name])

Error using imread (line 368) ; File "..." does not exist

Hi. change your current folder to myFolder: cd(myFolder) or use this: im1 = imread([myFolder pngfiles(1).name])

8 years ago | 0

| accepted

Answered

Take mininum over only two dimensions of 4-d array

Hi. R=reshape(1:16,[2 2 2 2]); M=min(min(R,[],4),[],3);

Take mininum over only two dimensions of 4-d array

Hi. R=reshape(1:16,[2 2 2 2]); M=min(min(R,[],4),[],3);

8 years ago | 0

Answered

Call functions with names generated from strings

Hi. fluid.muO=@(p) p.^2+1; fluid.muW=@(p) cos(p)+2*sin(p); phase = 'O'; name = strcat('fluid.mu',phase);%['fluid.m...

Call functions with names generated from strings

Hi. fluid.muO=@(p) p.^2+1; fluid.muW=@(p) cos(p)+2*sin(p); phase = 'O'; name = strcat('fluid.mu',phase);%['fluid.m...

8 years ago | 0

| accepted

Answered

Is it wrong if PSNR is coming IN range of 128 - 170

Hi. It's not wrong, but it's unusual: <http://en.wikipedia.org/wiki/PSNR>

Is it wrong if PSNR is coming IN range of 128 - 170

Hi. It's not wrong, but it's unusual: <http://en.wikipedia.org/wiki/PSNR>

8 years ago | 0