Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

cell contents assignment to a non-cell array object

4 vues (au cours des 30 derniers jours)
sharmila velu
sharmila velu le 8 Jan 2018
Clôturé : MATLAB Answer Bot le 20 Août 2021
clc;
clear all;
close all;
%disp('******************* LMI *******************')
%warning('off','YALMIP:strict') 
global r
yalmip('clear');
r=2;
c1=1;
C=[c1 0 0 0 0 0;
0 c1 0 0 0 0;
0 0 c1 0 0 0;
0 0 0 c1 0 0;
0 0 0 0 c1 0;
0 0 0 0 0 c1];
A{1}=[-0.01 0 0;0 -.05 0;1 .01 0];
A{2}=[0 .01 -0.1;0 0 -1;0 .02 .1];
B{1}=[0;-.02;.01];
B{2}=[0;-.02;.01];
D{1}=[0.01;.002;.001];
D{2}=[-.01;.02;.04];
E{1}=[0 -2 0;2 0 0;1 -.2 0];
E{2}=[0 -1 1;.1 -1 0;1 -1 0];
C{1}=[0 .1 0];  
C{2}=[1 0 .10];
K{1}=[.001 .3 0];
K{2}=[-2 -.03 1];
M{1}=0.01;
M{2}=1.5;
zer=[0 0 0;0 0 0;0 0 0];
zer1=[0;0;0];
L=[1 2 1];
%TildA{1}=[-B{1}*M{1}*C{1} zer; zer -B{1}*M{1}*C{1}];
% define known matrix
for i=1:r
      for j=1:r
TilA{i,j}=[A{i} zer;
      zer A{j}+B{j}*K{j}];
TildA{j}=[-B{j}*M{j}*C{j} zer; zer -B{j}*M{j}*C{j}];
TilB{j}=[-B{j}*M{j} B{j}*M{j}*C{j}; zer1 zer];
TilD{i}=[D{i};zer1];
TilE{i}=[E{i}; zer];
      end
  end
  1 commentaire
Walter Roberson
Walter Roberson le 9 Jan 2018
Modifié(e) : Walter Roberson le 13 Avr 2018
Using "clear all" inside a program is like Wile E. Coyote blowing up the butte he is standing on, expecting that he will be safe from falling as long as he does not look down. The only time you should ever use "clear all" inside a program is if you are writing a short script that you intend to be like restarting MATLAB without actually restarting MATLAB.

Réponses (1)

ANKUR KUMAR
ANKUR KUMAR le 9 Jan 2018
C{1}=[0 .1 0];
C{2}=[1 0 .10]; K{1}=[.001 .3 0];
The errors are in these above codes. You already have defined C in double format (as in matrix in the third line). And you are trying to enter in C input as in cell. This is not possible.
My suggestion is to change the above code by
C1{1}=[0 .1 0];
C1{2}=[1 0 .10]; K{1}=[.001 .3 0];
Few more change you should to do are,
TildA{j}=[-B{j}*M{j}*C1{j} zer; zer -B{j}*M{j}*C1{j}];
TilB{j}=[-B{j}*M{j} B{j}*M{j}*C1{j}; zer1 zer];

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by