![]() |
||
|
Registered User
加入日期: Jul 2003
文章: 343
|
請問站上有人懂MATLAB嗎
請問一下各位站上有人懂MATLAB嗎
有個題目我不知如何用MATLAB寫出答案 所以想請教一下 ↓題目↓ http://hyk.adsldns.org/phpbb/album_pic.php?pic_id=188 可以的話請附加註解 不然小弟可能會看不懂 ![]() 希望各位大大不令指教 ![]() |
|||||||
|
|
|
Major Member
![]() 加入日期: Dec 2003 您的住址: 江戶
文章: 113
|
題目稍微看了一下 不是怎麼難
應該是用 if else elseif 判斷 剎那不是matlab高手 只能說這題目花點時間就可以寫的出來 ![]() 先在紙上寫一下自己會怎麼判斷 再打進medit中除錯吧 這種題目用matlab來跑算簡單的了 就請多費心了 不然和同學一起討論吧 |
||
|
|
|
Registered User
加入日期: Jul 2003
文章: 343
|
嗯∼這一題確實要用 if else elseif
可惜我們班都沒有人會...... 小弟自己對MATLAB又一知半解 可以請各位大大給些意見嗎? ![]() |
|
|
|
Major Member
![]() 加入日期: Dec 2003 您的住址: 江戶
文章: 113
|
該怎麼說
剎那以前對matlab也很感冒 每寫每錯 老師也不教 花了好久才知道怎麼開始 這種題目明顯的是要建立大大分析題目和建立邏輯 這對寫任何程式都很重要 而且別人教不來的 因為同一題每個人都寫法絕對都不一樣 內容完全一樣的有鬼居多 剎那覺得大大可以請教助教或是老師 引導你們這題如何開始 ![]() 老師的作業和考試不是要刁難學生用的 而是讓學生學習的工具之ㄧ 這種題目用matlab來寫不難 難的是你如何去建立這個題目的思考邏輯 千萬不要為寫作業而寫 這樣大大學不到什麼東西的 說了這麼多 剎那還是沒幫到什麼忙 ^^" |
|
|
|
Major Member
![]() 加入日期: Aug 2000 您的住址: 我家廁所
文章: 254
|
引用:
你指的沒人會是演算法的部分沒人會? 還是MATLAB語法沒人會? matlab語法跟C滿像的 只不過沒C那麼麻煩 如果是不會matlab的語法 請善用 help 指令(或function) 或直接打lookfor 關鍵字 例如輸入help if就會告訴你matlab中 if 的使用法
__________________
嘴巴臭 眼睛痠 火氣旺....該休息了 |
|
|
|
|
*停權中*
加入日期: Oct 2003
文章: 1,311
|
引用:
這是偶寫的一段有用倒 for loop if elseif else 的 matlab code. 基本上用法 C 沒啥差別, 只不過是一點語法的小差別, 偶用顏色大概把 for 還有 if 的範圍標示出來, 應該不至於看不懂, 至於題目本身不算難, 多想想應該就知道要怎麼解了. 代碼:
fid = fopen('lenna_jpg2.asc','r');
dctmp = 0;
X_unzzscantmp = zeros(size(X, 1)/8, size(X, 2)/8, 64);
Y_dct8 = X;
% load in every 8x8 block
for m=1:size(X, 1)/8
for n=1:size(X, 2)/8
EOBflag = 0;
for g=1:64
if (EOBflag == 0)
ftmp = fscanf(fid, '%s', 1);
end
if EOBflag == 1
X_unzzscantmp(m, n, g) = 0;
elseif strcmp(ftmp, 'EOB')
ftmp = 'nogood';
EOBflag = 1;
X_unzzscantmp(m, n, g) = 0;
else
if g == 1
dctmp2 = dctmp;
X_unzzscantmp(m, n, 1) = str2double(ftmp) + dctmp2;
dctmp = X_unzzscantmp(m, n, 1);
else
X_unzzscantmp(m, n, g) = str2double(ftmp);
end
end
end
Y_dct8(((m-1)*8+1):m*8, ((n-1)*8+1):n*8) = unzzscan(X_unzzscantmp(m, n, 1:64));
end
end
fclose(fid);
此文章於 2003-12-19 12:19 AM 被 Cudacke 編輯. |
|
|
|
|
New Member
加入日期: Jun 2003
文章: 2
|
剛好小弟也有關matlb4的問題
有人知道fft這個指令怎麼使用嗎? 方波轉傅立葉級數,老師說一定要用到fft的指令 他什麼都沒教就把這軟體給我們班就說要做這個東西..... 請問有人會做嗎?謝謝 |
|
|
|
Major Member
![]() 加入日期: Jul 2001
文章: 170
|
|
|
|
|
Senior Member
![]() ![]() ![]() 加入日期: Jun 2001 您的住址: 綠島
文章: 1,371
|
想不到這麼多人會...
有誰能救我..我快被Matlab搞到死了... 我的碩士論文只差一步....但是....Matlab改不出來... GA+Matlab的論文...好痛... ![]()
__________________
武士:看來我不應該來。 紫霞:現在才知道太晚了, 武士:留下點回憶行不行? 紫霞:我不要回憶,要的話留下你的人。 武士:這樣只是得到我的肉體,並不能得到我的靈魂,我已經有愛人了,我們不會有結果,你讓我走吧。 紫霞:好,我讓你走,不過臨走前你要親我一下。 |
|
|
|
Registered User
加入日期: Jul 2003
文章: 343
|
經過了幾天的思考
同學間也是霧煞煞 弟還是沒有頭緒,只會這種簡單的: 在M file中指定function function [value, radius] = sun(angle) radius=angle*pi/180 value=sin(radius) 在工作視窗中輸入sun >> sun(30) radius = 0.5236 value = 0.5 ans = 0.5 這種題目我實在是想不透 ↓題目↓ You are working for a local grocery store, and your job is to determine how to break down customers’ change. That is, if a customer’s total charge came to $221, and they handed you a $1000 bill, the cash register will tell you that you owed them $779 change; the best way to breakdown $779 would be one $500 bill, one $200 bill, one $50 coin, two $10 coins, one $5 coin, and four $1 coins. Please write a m-file (the filename should be SID_hw5.m), which prompt the user for a customer’s total charge and total payment; then your program should compute how much charge the customer is due and how this change should be broken down so that the customer receives the minimum number of bills and coins. You will have bills such as $2000, $1000, $500, $200, $100, and coins of $50, $10, $5, $1, $0.25,$0.1,$0.05 and $0.01 in the cash register.and in the cash register. 加入美式的幣制,0.25是 quarter,0.1是 dime,0.05是 nickel,0.01是 penny。 有兩個input,一個是顧客給的錢,一個是顧客的消費金額。再加上條件判斷,若給的錢少於消費金額時,應該顯示「錢不夠」之類的。如果是正常情況的話,ouput 應該是每種紙鈔與硬幣的數量。 即將是dead line了 請問剎那還有各位大大該怎麼寫呢 非常感謝Cudacke大大的解答,但是您的寫法對弟來說太深奧了 弟是個初學者,希望能用最簡單的方法寫出。 此文章於 2003-12-22 09:50 PM 被 dwight1116 編輯. |
|
|