フィルターのクリア

Matlab cell array question

3 ビュー (過去 30 日間)
Lam Chun Ting
Lam Chun Ting 2012 年 3 月 31 日
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!!

回答 (2 件)

Wayne King
Wayne King 2012 年 3 月 31 日
  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 件のコメント
Lam Chun Ting
Lam Chun Ting 2012 年 3 月 31 日
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?

サインインしてコメントする。


Wayne King
Wayne King 2012 年 3 月 31 日
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 件のコメント
Lam Chun Ting
Lam Chun Ting 2012 年 3 月 31 日
thx for your help..I will have a look by myself

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by