Borrar filtros
Borrar filtros

Matlab cell array question

3 visualizaciones (últimos 30 días)
Lam Chun Ting
Lam Chun Ting el 31 de Mzo. de 2012
Create a 2x2 cell array A with the following elements: 4x4 identity matrix; the string ‘Leicester is the largest city in world’, the complex number (3+i*10)^3; the array of N=20 numbers (of type single) representing the geometric progression with the base 5 and the common ratio 1/2. Replace the element ‘Leicester is the largest city in world' with ‘Leicester is a nice town’. Plot the created cell.
I've done my Matlab code for this question, can anyone help me to check this question, please?
A(1,1)={eye(4)};
A(1,2)={'Leicester is the largest city in the world'};
A(2,1)={(3+10i).^3};
A(2,2)={5:1/2:20};
A{1,2}='Leicester is a nice town';
A{1,2}=true;
cellplot(A);
A;
Many thanks for helping!!

Respuestas (2)

Wayne King
Wayne King el 31 de Mzo. de 2012
  1. (3+1j*10)*3 is not the same as (3+1j*10)^3, so I'm not sure which one you mean when you wrote "(3+i*10)3" Maybe you just forgot the ^?
  2. 5:1/2:20 is not correct. That is a linearly-spaced vector with increments of 1/2. That is not what your assignment wants. Look at a geometric series.
  3. I'm not sure why you put A{1,2} = true; I don't see anything in the question you posted that asks for that.
  1 comentario
Lam Chun Ting
Lam Chun Ting el 31 de Mzo. de 2012
1)sorry..I forgot to type ^, but I fix it now.thx
2)May you tell me how would you compute this please?
3) because they ask me to replace the element.‘Leicester is the largest city in world' with ‘Leicester is a nice town’, so I put A{1,2}=true, will it be correct?

Iniciar sesión para comentar.


Wayne King
Wayne King el 31 de Mzo. de 2012
I think you were correct when you replaced the string.
A{1,2}='Leicester is a nice town';
A{1,2} = true is replacing .‘Leicester is the largest city in world' with 1. That is not what you want.
You do not need the .^ because you only have a single complex number.
I do not want to just tell you how to produce the series, because it is your assignment. Look at the formula for a geometric series.
  1 comentario
Lam Chun Ting
Lam Chun Ting el 31 de Mzo. de 2012
thx for your help..I will have a look by myself

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by