MATLAB小白求大神解答,matlab小白提問,求大神解答!謝謝!

2021-03-04 03:29:15 字數 3479 閱讀 6625

1樓:匿名使用者

function f=find_max(a)f=-inf;

for i=1:1:length(a)

if a(i)>f

f=a(i);

endend

【matlab】小白求大神解答

2樓:匿名使用者

>> n = 0:100;

>> a = (-1).^n .* pi.^(2*n)./ factorial(2*n);

>> sum_a = sum(a)

sum_a =

-1.0000

【matlab】小白求大神解答

3樓:匿名使用者

x = rand(3,1)*10

y = rand(3,1)*10

cxy = cross(x,y) % 叉乘dxy = sum(x.*y) % 陣列元素操作計算x和y的點乘dxy == dot(x,y) % 將結果和matlab內建的計算點乘的函式dot(x,y)的計算結果相比較

z = (x.^2+y.^2)./(x-y)./exp(-x) % 建立一個滿足如下關係的一維列向量z

【matlab】小白求大神解答

4樓:匿名使用者

x1=x;

x1(find(x<0))=0;

x2=x(find(x>3));

temp=find(mod(x,2)==0);

x3=x;

x3(temp)=x3(temp)+3;

temp=mean(x);

x4=x;

x4(find(xtemp))=x5(find(x>temp))-temp;

matlab小白..提問,求大神解答!謝謝! 10

5樓:木生子識時務

a=[-10 0 10],是建立一個新的陣列a,且賦值為 -10 0 10,可以看成一個 1*3 的矩陣。

a=a(1,i),是依次取出 a 中的 3 個元素,然後賦值給 a

matlab小白,求大神教這兩道題目!(後面幾個圖是函式) 100

6樓:老女人之me剋星

i had no clue that she can love that much.

7樓:匿名使用者

你的**看不清楚啊?

matlab求大神解答

8樓:我都知道了哦

if a(p,q)=i

其中的「=」應該是「==」

此外,要多用「;」啊!

你這段**一旦執行,***mand window會非常混亂。

9樓:匿名使用者

親。。if a(p,q)=i

應該是 if a(p,q)==i

有2個等號

matlab小白一個,求大神指點

10樓:我行我素

^我改了下,現在能執行了:

clear

i=input('please choose a pla***:1(水星)2(金星)3(火星)4(木星)5(土星):');

r=7.78*1e11;

if i<1||i>5

return

endpla***=;

ms=1.99e30;

g=6.67e-11;

k=g*ms/4/pi^2;

t=sqrt(r^3/k);

w=2*pi/t;

re=1.496e11;

te=sqrt(re^3/k);

we=2*pi/te;

r=r/re;

r=1+r;

th=linspace(0,2*pi);

fg=figure;

plot(0,0,'g.','markersize',15)

plot(cos(th),sin(th),'r--')

hold on

plot(r*cos(th),r*sin(th),'k--')

s=plot(1,0,'r.','markersize',16,'erasemode','xor');

xs=r*cos(th);

ys=r*sin(th);

ps=plot(1+xs,ys,'--','markersize',2,'erasemode','xor');

x0=r;

y0=0;

pl=plot([0,x0],[0,0],'-m.','erasemode','xor');

axis equal

grid on

fs=16;

xlabel('\itx/r\rm-e','fontsize',fs)

ylabel('\ity/r\rm_e','fontsize',fs)

title('在地球上觀察行星繞太陽的執行軌跡','fontsize',fs)

text(0,0,'地球','fontsize',fs)

text(-1-r,(1+r)/2,'穹頂','fontsize',fs)

stext=text(1,0,'太陽','fontsize',fs);

ptext=text(x0,0,pla***,'fontsize',fs);

pause

t=0;

dt=te/200;

if i>2

dt=dt*2;

endwhile get(fg,'currentcharacter')~=char(27)

t=t+dt;

xe=cos(we*t);ye=sin(we*t);

x=r*cos(w*t);y=r*sin(w*t);

set(s,'xdata',xe,'ydata',ye);

set(pl,'xdata',xe+x,'ydata',ye+y);

set(ps,'xdata',xe+xs,'ydata',ye+ys);

th=atan2(y+ye,x+xe);

x=r*cos(th);y=r*sin(th);

set(pl,'xdata',[0,x],'ydata',[0,y])

set(stext,'position',[xe+x,ye+y]);

plot([x0,xe+x],[y0,ye+y])

x0=xe+x;

y0=ye+y;

drawnowend

matlab 中a(end,1:2:end) 是什麼意思,請舉例說明。小白求教

11樓:匿名使用者

a是一個陣列假設為n*n,

a(end,1:2:end) 的意思是從a中取元素,取得的元素為a的最後一行,從第1列開始每個兩個元素取一個,舉個例子:

matlab小白求大神解答,MATLAB小白求大神解答

x1 x x1 find x 0 0 x2 x find x 3 temp find mod x,2 0 x3 x x3 temp x3 temp 3 temp mean x x4 x x4 find xtemp x5 find x temp temp matlab 小白求大神解答 function...

wot 坦克世界 新手幾個小白問題 求大神解答

嗯 怎麼說呢,也經過過樓主的這個過程,所以也來說說,一天玩兩個小時其實還好,快的話也可以玩個10幾局了,坦克世界裡面很多都是老玩家,很多人的時間都是按年算的了,是個挺有趣的遊戲,這樣跟你介紹下我玩過的幾個線的td和spg吧 td 法系 中前期不怎麼好玩,出頭時間估計在7 8級,樓主你玩到法國的amx...

matlab問題,求大神指教,matlab問題,求大神指教!

原因是,nsa的表示式中,有一個要進行開方的項 pi ff.hh.1000 vc 2 1 a 2計算出現負數,所以導致nsa為複數,而surf繪製曲面不允許複數資料存在。可以很容易檢驗 tmp pi ff.hh.1000 vc 2 1 a 2 min tmp ans 0.3600 sum tmp 0...